Rajesh
Rajesh

Reputation: 459

Dynamics CRM - multiple plugins on same event, stage with same rank - Order of Execution?

I came across an interview question for which I got different answers from friends and peers so I thought I'd ask here.

We generally use the plugin ranking for defining the order in which different plugins execute in order to overcome the dependency issues.

Question

If an entity has multiple plugins (be it from different dlls or same dll) registered on the same event and same stage and all of them have the Rank/Order as 1 - what is the order in which they get triggered?

Do they all execute in parallel? Does it depend on which plugin got registered first etc ? Please point me to any MSDN reference if you can.

Thanks in advance.

Upvotes: 3

Views: 8011

Answers (4)

IsolatedStorage
IsolatedStorage

Reputation: 1215

Updated for the current implementation of the Plugin Registration tool. enter image description here

https://learn.microsoft.com/en-us/power-apps/developer/data-platform/register-plug-in#general-configuration-information-fields

Upvotes: 0

Jim Daly -MSFT-
Jim Daly -MSFT-

Reputation: 258

The SdkMessageProcessingStep.SdkMessageFilterId is what manages the order in which plug-ins are executed when all other factors are equal.

Compilation date was documented years ago. IDK if it was true then, but it is not now.

Upvotes: 3

As a good practice (also a good interview answer), it’s not safe to rely on CRM Product’s fallback plan of compilation date logic. Use the execution order wisely based on our requirement.

If this CRM logic changes tomorrow or Dev team added a new plugin to the same assembly/message/stage, which has to execute on top or in between other plugins then the dependency issues rises. So design well.

Upvotes: 1

Dot_NET Pro
Dot_NET Pro

Reputation: 2123

Hi please find below copied from MSDN,

Execution Order:

Specifies the order, also known as rank, that plug-ins are executed within a 
pipeline stage. Plug-ins registered with an order value of 1 are executed 
first, followed by plug-ins registered with an order of 2, and so on. However, 
if there is more than one plug-in in a stage with the same order value, then 
the plug-in with the earliest compilation date is called first.

Using the Plug-in Registration Tool for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online

Upvotes: 8

Related Questions