Microsoft Dynamics CRM 4.0 Tidbits - Event Architecture

Girls On Film...

One of the biggest area of investments in CRM 4.0 is the complete re-design of the of event framework in order to improve the consistency and reliability of handling events through custom code. As part of this re-design, we have changed the CRM 3.0 name of business logic extensions from "Callouts" to the far more groovy name "Plug-ins". The high-level changes are as follows:

  • Unified Event Model - The same event framework is used by both plug-ins and workflow.
  • Multi-Tennant Aware - Plug-ins are registered per tennant and not deployment-wide.
  • Improved Deployment -  Plug-ins are registered using the SDK and the assemblies are stored in the database.
  • Offline Pluggin Support - The ability to run plug-ins whilst working offline in the Outlook Laptop Client.
  • Improved Performance - Support for both synchronous and asynchronous plug-ins.
  • Richer User Experience - Form data recovery on plug-in errors.
  • Better Developer Experience - Full execution context passed to the plug-in assembly

CRM 3.0 Callout Architecture

The callout model in CRM 3.0 was built on the .NET Framework v1.1 runtime and provided a fairly robust mechanism for running synchronous business logic written in C# or VB.NET. If you called the simple entity Create, Update or Delete methods then everything would work as expected (most of the time) and your callouts would be executed. However, if you called an entity-specific method then you might experienced some inconsistent behaviour.

For example, the "ConvertQuoteToSalesOrder" method causes the platform to execute a number of sub-steps including "CreateSalesOrder". However, because the platform performs these steps using an internal call (for performance reasons) rather than going via the Web Service, any callout handling the "CreateSalesOrder" pre-stage or post-stage events would never be executed. This is shown below.

CRM 3.0 Callout Architecture

CRM 4.0 Synchronous Plug-in Architecture

In CRM 4.0 we have implemented an execution pipeline model based on the .NET Framework v2.0 runtime. Pre-stage and post-stage plug-in events are now called as part of the execution pipeline and not within the Web Service process. So now when you call the "ConvertQuoteToSalesOrder" method a new execution pipeling is created within the platform. Each time additional steps such as "CreateSalesOrder" are called, another execution pipeline is created. This causes the pre-stage and post-stage events to for this step to execute correctly regardless of origin (UI, Web Service, Platform, Workflow etc) . This is shown below:

CRM 4.0 Synchronous Plug-in Archiecture

My thanks go to Vlatko Mrsic and Akezyt Janedittakarn from the CRM product team for the use of their architecture diagrams.

This posting is provided "AS IS" with no warranties, and confers no rights.

Laughing Boy