Tag Cloud

CRM 2011 (161) CRM 4.0 (144) C# (116) JScript (109) Plugin (92) Registry (90) Techpedia (77) PyS60 (68) WScript (43) Plugin Message (31) Exploit (27) ShellCode (26) FAQ (22) JavaScript (21) Killer Codes (21) Hax (18) VB 6.0 (17) Commands (16) VBScript (16) Quotes (15) Turbo C++ (13) WMI (13) Security (11) 1337 (10) Tutorials (10) Asp.Net (9) Safe Boot (9) Python (8) Interview Questions (6) video (6) Ajax (5) VC++ (5) WebService (5) Workflow (5) Bat (4) Dorks (4) Sql Server (4) Aptitude (3) Picklist (3) Tweak (3) WCF (3) regex (3) Config (2) LINQ (2) PHP (2) Shell (2) Silverlight (2) TSql (2) flowchart (2) serialize (2) ASHX (1) CRM 4.0 Videos (1) Debug (1) FetchXml (1) GAC (1) General (1) Generics (1) HttpWebRequest (1) InputParameters (1) Lookup (1) Offline Plug-ins (1) OutputParameters (1) Plug-in Constructor (1) Protocol (1) RIA (1) Sharepoint (1) Walkthrough (1) Web.config (1) design patterns (1) generic (1) iframe (1) secure config (1) unsecure config (1) url (1)

Pages

Friday, October 28, 2011

Event Pipeline in CRM 4.0

 

The message pipeline concept is implemented in the CRM platform as an event pipeline. The event pipeline performs sequential (synchronous) processing of a message and returns the result (called a response) to the platform. The term sequential processing is used because there are several points in the pipeline where business logic is executed as shown in the following diagram.

e3ce1347-6621-4b7e-98a0-0651844b2b5d

In the pipeline is the core platform operation. This is where the actual entity information processing (such as create, update, or delete) takes place. Immediately before and after the core platform operation are registration points where plug-ins containing custom code can be registered to execute. A plug-in that is registered for a pre-event, meaning before the core operation event, has the ability to modify the context (entity data) passed to the plug-in’s Execute method before passing the context on to the core operation. A pre-event plug-in can also prevent (cancel) the core operation. A plug-in that is registered for a post-event, meaning after the core operation event, has the ability to alter the context returned from the core operation and the response returned from the platform to the Web service caller. A plug-in registered asynchronously is a post-event plug-in that it is queued to be executed by the Asynchronous Service at a later time.

The event pipeline architecture provides the capability for a pipeline to initiate the execution of one or more subordinate pipelines in order to process an SDK request. The originating pipeline is known as the parent while each subordinate pipeline is called the child. Web service method calls, such as Execute, start a parent pipeline while internal platform calls start a child pipeline.

Let us look at an example of how this parent/child pipeline design works. For example, a parent pipeline that processes a CompoundUpdateRequest to update a salesorderdetail quantity would invoke a child pipeline to update the salesorderdetail and another child pipeline to update the associated salesorder total. However, even a simple request, such as CreateRequest for an account, can result in a child pipeline being executed.

When a complex request is processed by a pipeline, the pipeline first executes any registered pre-event plug-ins and the core platform operation. Next, the pipeline starts a child pipeline and temporarily suspends processing until the child pipeline has finished processing its request. After the child pipeline has completed, the parent pipeline can complete its post-event processing.

  1. Pipeline A : pre-events are processed.
  2. Pipeline A : core platform operation, child pipeline B executed.
  3. Pipeline B executes
    1. Pipeline B : pre-events are processed.
    2. Pipeline B : core platform operation.
    3. Pipeline B : post-events are processed.
  4. Pipeline A : post-events are processed.

As a plug-in developer, the significance of this parent/child pipeline design is that you must decide which pipeline your plug-in is to be registered with in order to accomplish the plug-in’s intended functionality. The parent pipeline processes the Web service message request. Child pipelines only process Create, Update, or Delete messages as required by the platform to process the parent pipeline’s message. To determine which message is being processed by a child pipeline, you must enable tracing in Microsoft Dynamics CRM. Information about how to enable tracing can be found in the Microsoft Dynamics CRM 4.0 Implementation Guide.

No comments: