Plugins are used to achieve custom functionalities before or after core application execution. To developed plugin Microsoft Software Development Kit is required. You can download CRM SDK from Microsoft Site. You can also find some sample code along with SDK which helps you develop plugin.
Before develop plugins in CRM is also required to understand exception pipe line and stage to trigger custom code. In Image you can see CRM execution pipe line flow-
Isolation
Plugin deployment in Microsoft Dynamics CRM is either Sandbox (Partial Trust) and outside of Sandbox full trust. If plugin is deployed in isolation mode, it will run with partial trust. The level of isolation allows HTTP and HTTPS web resources for external requests using Dynamics CRM web service.
To deploy a plugin without isolation mode, you need to deploy it using deployment manager and deploy administration is required for it.
Modes
There are two modes
- Synchronous Mode – Synchronous mode starts when event fires in CRM and it blocks CRM application till event is finished. This is not best choice as it delays process if execution takes more time and down performance.
- Asynchronous Mode – Asynchronous mode releases application execution while code is running in background.
Stages
There are three stages for plugin code execution event–
- Pre Validation – Pre Validation is part of pre execution it sends controls to plugin before form is validate in CRM.
- Pre Operation – In case of Pre Operation controls sends to plugin before core operation starts in CRM.
- Post Operation – it send control to plugin when core operation is finished in Dynamics.