RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Extending Microsoft Dynamics CRM 4.0 with Plug-Ins : Page 3

Microsoft Dynamics CRM 4.0 has a very flexible infrastructure that lets you extend the out-of-the-box behavior to meet ever-changing organizational business needs.


Plug-In Deployment and Registration

The unified event API in Microsoft Dynamics CRM 4.0 exposes methods that allow registering and unregistering plug-ins. You can deploy plug-ins either in the database or on a local disk; however, the recommended method is to deploy plug-ins in the database for easier distribution and maintainability. The disk deployment option is provided for backward compatibility with Microsoft Dynamics CRM 3.0 callouts.

You can also use the Plug-in Registration Tool available in the Microsoft Dynamics CRM 4.0 SDK, which is located in the tools\pluginregistration folder under the SDK. The tool is available as source code. Open the pluginregistration solution and run the project from Visual Studio.

In the plug-in registration tool (see Figure 2) enter the CRM server information and click Connect.

Figure 2. Connecting to a Server: Enter the CRM server information here, and click Connect.
Figure 3. Plug-In Registration Tool: Use the plug-in registration tool to register, import / export, update and unregister assemblies and workflow steps.

After logging in, you'll see a list of registered plug-ins and workflows displayed under each organizational unit (see Figure 3). You can use the Register menu to register plug-in assemblies and their steps.

Critical Info

There are a few important things to keep in mind about plug-ins:

Plug-in correlation: Certain scenarios might cause a plug-in step to execute in an infinite loop. For example a plug-in registered for an update event on an account updates the account on being executed. Always use the plug-in context to create a proxy to the CrmService because it can detect infinite loops. You can use the CreateCrmService method of the plug-in context to create a CrmService proxy. If you need to create a CrmService instance in the plug-in, set the service's CorrelationTokenValue property to a new instance of CorrelationToken class. The plug-in context CorrelationId, Depth and CorrelationUpdatedTime are passed in as instance parameters. The CorrelationToken class makes use of soap headers to maintain the context association with the caller.

Shared Variables: The plug-in context has a SharedVariables property bag that holds properties that plug-ins registered at different stages of the pipeline can share.

Offline support: You can register plug-ins for execution in offline mode. This feature allows support for plug-ins in Microsoft Dynamics CRM for Outlook. The plug-in context has an IsExecutingInOfflineMode property to check if the plug-in is being executed in offline mode.

For Further Reading

For more information, these two links are good places to start:

Sandeep Chanda has more than five years of experience in several Microsoft technologies. He currently works for Neudesic, a Microsoft National Systems Integrator and Gold Certified Partner, using technologies such as Silverlight 2.0, SharePoint, and Microsoft Dynamics CRM 4.0. Prior to joining Neudesic, Sandeep built applications for the credit card processing industry, using Microsoft BizTalk Server 2004/2006, Windows Workflow Foundation, and Microsoft SQL Server 2005.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date