CRM – Registering Plug-ins Made Easy

PluginRegistration tool v 2.0

Are you facing problems in registering plug-ins? Are you wondering if you could get a tool to generate the Xml and deploy plug-ins via Import/Export just like the way customizations are deployed? Are you confused with the various tools that shipped with SDK and how to use the registration API? If the answer is yes, then read this blog post.

CRM 3.0 exposed callouts so that ISV / Partner can extend CRM and run custom code when an action is triggered in CRM. Well, there were about 10 messages available to register the callouts. In Microsoft Dynamics CRM 4.0, the concept has been expanded to 64 messages. Now a plug-in could be registered on messages like ‘GrantAccess’ ,’ImportAll’. One more major enhancement is to expose the API for registering the plug-ins and steps (eg: On Post of Contact Create fire MyPlugin.Execute() method). The migration is good as the registration data is now stored in the database and customers do not have to worry about the pain in merging callout.config.xml and deploying the xml manually on all machines. This brings us to the question on the blog on how to write the API and if there is a tool to do this automatically.

There are 2 great tools that were shipped with the Microsoft Dynamics CRM 4.0 SDK.

  • PluginDeveloper is a command line tool that accepts Register.Xml and allows one to register the assembly, plug-ins, steps and images at one shot. Main limitation of the tool is that one has to generate the Xml with all the right values.
  • PluginRegistration is a UI tool that allows users to do finer tasks like registering / unregistering the assembly, plug-in, and steps. It has the capability to display what plug-ins are registered in the CRM. It is very developer friendly as user can learn by clicks. Drawback of the tool is number of clicks needed to re-do any work that is done previously.

Let’s talk about the interesting part of this blog “New and re-engineered PluginRegistration tool” that has tons of new features and a brand new UI. There are 3 core scenarios that were addressed in this tool.

1. Developer Scenario: An ISV creates a plug-in and registers it on Contact Create as PreCallout (Aka BeforeMainOperation Plug-in). He can then debug the plug-in by registering on Disk. Once the errors are fixed, he can then update the pluginassembly to be uploaded to the database.

2. Deployment Scenario: An ISV builds few plug-ins and registers on multiples steps. Images are registered on few of them. He tests them in the Dev environment but would like to port the registrations to a different organization. PluginRegistration tool supports Export and Import of the solution xml to solve this scenario.

3. Admin Console: Couple of ISV installs their plug-ins on a Customer Organization. Admin at the Customer side saw some problems with “Contact Create” action. He would like to know what plug-in are fired and what the pipeline is for the “Contact – Create”. He then finds the trouble causing plug-in and disables it. So it is all about troubleshooting. PluginRegistration tool solves this problem by allowing Enable/Disable/Unregister operations on steps, plug-in.

Complete feature-set of the tool

  1. Register a pluginassembly, step and image. Validates the data before sending to CRM
  2. Update pluginassembly, step and image
  3. Unregister a pluginassembly shall cascade unregister all the children
  4. Enable, Disable a step
  5. Auto retrieve all CustomEntities information from the organization when registering the step
  6. Allows setting more values on step (e.g.: configuration, secureconfiguration, filteringattributes, etc.)
  7. Auto retrieve CustomAttributes on entity when registering images
  8. Search the pluginassembly, type, steps, images by names
  9. Visualize the status of the CRM Organization multiple views
    1. View by Assembly : What steps are registered on what plug-in
    2. View by Entity : What steps are registered on an entity(e.g.: contact)
    3. View by Message : What steps are registered on a message (e.g.: create)
  10. Shows the list of Microsoft Dynamics CRM 3.0 callouts registered in the organization
  11. Work with multiple organizations at the same time
  12. Exports the Xml in the same format that can be accepted by PluginDeveloper tool

PlugIn

PluginRegistration Tool can be downloaded from the following location. You need to add references and build it locally. Once built, it can be used with any organization. Walkthroughs and ReadMe are included in the download.

http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=crmplugin&DownloadId=320

I hope this article helps jump start the plug-in registration process for you and eases some pain when building rich business applications in Microsoft Dynamics CRM 4.0.