A plugin is a custom code which is intended to be executed when specific actions (events) happen on a certain Microsoft CRM entity. Plugins are necessary when integrating MS CRM. For example, if you want to integrate MS CRM with other systems, and you need to integrate data between 2 or more systems, then you™ll need to post the newly created records (accounts for example) on CRM to the other systems.
A plug-in is essentially an add-in for CRM to perform some business logic during various operations; typically when a record is saved (whether create or update). These can operate synchronously or asynchronously – though many users want whatever it is to happen immediately; rather than wait some (unspecified) time (ala workflow) – so synchronous is the obvious choice.
Pre or Post
A new concept called ‘Solution’ which bundles the components was introduced in CRM 2011. Solutions could help us to deploy plug-ins in a very good manner. If you open a solution in CRM 2011 you could find out a section called ‘Plug-in Assemblies.
Now consider we have a plug-in called myPlugin with steps Create and Update of Contact Entity. So let’s register the plugin using the CRM 2011 Plugin Registration tool.
Once its registered, it would be available in our solution. So navigate to Plug-in Assemblies section of the solution and click on ‘Add Existing button’ . Then you would get the following window. All registered plugins would be listed here.
We could choose the plugin and then click OK.
So our plugin is added to the solution as shown above. So this is how we bundle the plugin in the solution. However its a very good practice to bundle the steps of plugin too.
So lets consider the following 2 steps to be bundled in the solution.
Create Contact & Update Contact steps
So navigate to ‘Sdk Message Processing Steps’ section of our solution which could be found just below the ‘Plug-in Assemblies’ section. And click on add existing option.
As you could see the plugin message steps are added to the soultion.