Best practices and guidance regarding plug-in and workflow development for the Microsoft Dataverse

This list below contains all of the guidance and best practices regarding the plug-in and workflow development within the Dataverse.

Best Practice Description
Do not use batch request types in plug-ins and workflow activities Don't use ExecuteMultipleRequest or ExecuteTransactionRequest message request classes within the context of a plug-in or workflow activity.
Develop IPlugin implementations as stateless Members of classes that implement IPlugin are exposed to potential thread-safety issues, which could lead to data inconsistency or performance problems.
Do not duplicate plug-in step registration Duplicate plug-in step registration will cause the plug-in to fire multiple times on the same message/event.
Do not use parallel execution within plug-ins and workflow activities Multi or parallel threading within plug-ins or custom workflow activities is not supported.
Implement all types of queries when filtering results using PreOperation RetrieveMultiple For best performance and consistent results for all applications, you must implement filtering for all types of queries that can be used with plug-ins that are registered for the PreOperation stage of RetrieveMultiple
Include filtering attributes with plug-in registration If no filtering attributes are set for a plug-in registration step, then the plug-in will execute every time an update message occurs for that event.
Limit the registration of plug-ins for Retrieve and RetrieveMultiple messages Adding synchronous plug-in logic to the Retrieve and RetrieveMultiple message events can cause slowness.
Manage plug-ins in single solution The definition of a plug-in assembly should be maintained within a single solution.
Optimize custom assembly development Consider merging separate plug-ins/custom workflow activities into a single custom assembly to improve performance and maintainability and move plug-ins/custom workflow activities into multiple custom assemblies if an assembly size is near the sandbox assembly size constraints.
Set KeepAlive to false when interacting with external hosts in a plug-in KeepAlive property set to true in the HTTP request header or not explicitly defined as false can cause increased execution times of plug-ins.
Set Timeout when making external calls in a plug-in Limit the time period that external calls will expect a response within plug-ins.
Use InvalidPluginExecutionException in plug-ins and workflow activities Use InvalidPluginExecutionException when raising errors within the context of a plug-in or workflow activity.
Use ITracingService in Plug-ins Use the ITracingService within your plug-ins to gain insight into what happens when your code runs.
Verify certification dependencies for plug-ins making outbound calls Ensure that any certificates that your code depends on for outbound calls have a valid chain of certificates.

See Also

Apply business logic using code
Use plug-ins to extend business processes
Workflow extensions