Best practices and guidance regarding plug-in and workflow development for the Common Data Service

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

Best Practice Description
Avoid usage of batch request types in plug-ins and workflow activities You shouldn'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.
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.
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.
Remove unsupported code that uses reflection in custom workflow activities Workflow activities containing unsupported code that uses reflection will break in the coming months unless it is removed.
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.

See Also

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