Dynamics Plugins

D356 EVENT PIPELINE STAGE OF EXECUTION

Dynamics CRM Pipeline Diagram

 

The event execution pipeline processes events either synchronously or asynchronously. The platform core operation and any plug-ins registered for synchronous execution are executed immediately. Synchronous plug-ins that are registered for the event are executed in a well-defined order. Plug-ins registered for asynchronous execution are queued by the Asynchronous Queue Agent and executed at a later time by the asynchronous service. 

Important 
Regardless of whether a plug-in executes synchronously or asynchronously, there’s a two-minute time limit imposed on the execution of a (message) request. If the execution of your plug-in logic exceeds the time limit, a System.TimeoutException is thrown.  

If a plug-in needs more processing time than two minutes, consider using a workflow or other background process to accomplish the intended task.  

This two-minute time limit applies only to plug-ins registered to execute under partial trust, also known as the sandbox.  

 

Pre validation 

  • Stage value is 10 
  • Registered Plug-in run before the form is validated 
  • Useful if you want to implement business logic before the actual validation starts.  i.e., Changes made in plug-in won’t be saved if the validation of the main system plugins complain because the changes are outside the database transaction. 
  • Ex – Some “delete” plug-ins. Deletion cascades happen prior to pre-operation, therefore if you need any information about the child records, the delete plugin must be pre-validation. 

 

Pre -operation 

  • Stage value is 20 
  • After validation and before the values are saved to the database 
  • In create message, this operation does not allow you access to the GUID generated after creation of record 
  • Example uses: If and “update” plug-in should update the same record, it is best practice to use the pre-operation stage and modify the properties. That way the plug-in update is done within same DB transaction without needing additional web service update call. 

 

Platform Core Operation 

  • Stage value is 30 
  • This stage is the in-transaction main operation of the system, such as Create, Update, etc. 
  • No Plugin can be registered under this stage and is only for internal use. 

 

Post operation 

  • Stage value is 40 
  • Plugin will run after the values have been inserted/changed on the database 
  • In create message, this operation allows you access to the GUID generated after creation of record 

 

One thought on “D356 EVENT PIPELINE STAGE OF EXECUTION

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s