What is it
A plug-in is custom .NET compiled code that can be used to inject custom business logic by modifying the standard behavior of the CRM platform .
The plug-in is registered to be:
- Stored in a specific location (database, disk, GAC);
- Executed in a environment with specific isolation level (sandbox, none);
- Against events that are triggered when a specific action takes place within a specified CRM entity.
An event is a system message that is internally translated into a web service cal to execute an operation.
The plug-in code runs in CRM server in the context of an execution pipeline: It can be registered to execute before or after an operation is completed, and can run either synchronously or asynchronously.
When to use it
Plug-in runs server-side with compiled code and should always be the preferred method of implementing business logic since client-side code is vulnerable to different client environment, browsers, browser settings, etc.
When not to use it
If visual interface or user interaction is required, then client-side code must be used.
Synchronous vs Asynchronous Execution
A synchronous plug-in is executed by the CRM core system and the event will wait until the plug-in finishes the execution.
Asynchronous plug-ins are executed by asynchronous service and therefore asynchronous plug-ins allow triggered event to finish before plug-in code runs.
Microsoft CRM Online support the execution of plug-ins only in an isolated environment know as a sandbox. This environment does not allow to access to the file system, system event log,