When registering a plugin step, users have the flexibility to select from a few configuration options. The plugin can trigger at different stages of the execution pipeline, which are as follows:
- Pre-validation: It is used for validation purposes
- Pre-operation: It is used to alter the record before saving it
- Post-operation: It is used to update other entities once the execution is done
The introduction to this chapter contains a diagram highlighting the different events in the execution pipeline. The following table lists the different stages, their number, a short description, and whether they are executed within a transaction:
Stage Name |
Stage Number |
Description |
Within Transaction |
Pre-validation |
10 |
The validation event that takes place before the operation. |
Not guaranteed |
Pre-operation |
20 |
The event that takes place right before the operation. |
Yes |
MainOperation |
30 |
An event that cannot be overridden. It represents the main operation when the changes are persisted in the database. |
Yes |
Post-operation |
40 |
The stage that triggers after the operation. This event can be synchronous or asynchronous. |
Yes, if synchronous |
To learn more about the Microsoft Dynamics 365 event execution pipeline, check out the following MSDN article at https://msdn.microsoft.com/en-us/library/gg327941.aspx
The plugin registration tool also allows you to enter the order in which plugins are executed, in case you have a collection of plugins executing on the same record with the same configuration.
The plugin can also be registered synchronously or asynchronously. Synchronous plugins can enhance the user experience as the results appear straight away. Asynchronous plugins are great for long--running processes.
Plugins can be registered to execute offline as well, by ticking the Offline checkbox in the Deployment option. Offline plugins are great to execute logic on disconnected mobile devices; however, caution must be applied when using the offline option, especially if the user does not have access to all records offline.
Finally, plugin steps can have a (secure or non-secure) configuration string associated with them (typically XML). This is useful when you want to pass static data to your plugin (usually configuration data).