3

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.

Rajesh
  • 449
  • 2
  • 9
  • 22

4 Answers4

8

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

Dot_NET Pro
  • 2,095
  • 2
  • 21
  • 38
  • Thank you for the information. Believe it holds true for all CRM versions? – Rajesh Nov 23 '17 at 06:48
  • 2
    This is not correct now. The link is to content that is now archived. Compilation date is not a factor today. – Jim Daly -MSFT- Feb 20 '19 at 00:35
  • I had two environments, one was a backup of the other. Two plugins with the same Rank in same dll. In one environment plugin A ran first, in the second environment plugin B ran first. Took a few hours to catch. version 8.1.0. – AJ AJ Aug 23 '21 at 13:45
3

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.

Jim Daly -MSFT-
  • 258
  • 1
  • 8
1

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.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
0

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

IsolatedStorage
  • 1,175
  • 12
  • 12