Please explain difference and use of senario of IPluginExecutionContext ,IPluginExecutionContext2,IPluginExecutionContext3,IPluginExecutionContext4 D365 CRM.
As I know IPluginExecutionContext we used in plugin that run of CRM. but I don't know others use
Hi Shaun,
You can take a look at this documentation:
learn.microsoft.com/.../microsoft.xrm.sdk.ipluginexecutioncontext
Is there a link in the documentation somewhere as to these changes and when they occurred?
Just curious, as properties such as plugin depth, shared variables and pre/post entity images have been in the original IPluginExecutionContext interface since at least the CRM2011/2013 days from what I can remember.
Hi Radhika,
the IPluginExecutionContext
interface is used to provide information about the current plugin execution context to the plugin code. It provides access to a number of objects and properties that can be used by the plugin to perform its logic. There are multiple versions of this interface, each with slightly different functionality:
IPluginExecutionContext
: This is the original version of the interface, which provides basic information about the current plugin execution context, such as the input parameters, output parameters, and the target entity.
IPluginExecutionContext2
: This version of the interface was introduced in Dynamics 365 (CRM) and provides additional functionality over the original version, including the ability to access the related entities, the depth of the plugin execution, and the business process flow stage, if applicable
IPluginExecutionContext3
: This version of the interface was introduced in Dynamics 365 (CRM) and provides additional functionality over the previous version such as access to the shared variables, the source entity of an operation, the Target Entity and Pre Entity images
IPluginExecutionContext4
: This version of the interface was introduced in Dynamics 365 (CRM) and provides additional functionality over the previous versions such as access to the execution context mode, the initiating user and its related attributes, access to the child pipeline execution context, and the ability to cancel the execution of the plugin
As you can see, each version of the IPluginExecutionContext
interface provides additional functionality over the previous version. When developing plugins for Dynamics 365 CRM, you can use the version of the interface that best suits the needs of your plugin. As newer version of the interface have been introduced, developers can have
I think "3" has an additional "AuthenticatedUserId" property.
"4" Implements all the previous ones, so you would get access to everything.
Where and when you would use them I can't say.
From the documentation it suggests IPluginExecutionContext2 has extra details when changes have come from a Dynamics Portal.
It is not obvious what 3 and 4 are for though.
IPluginExecutionContext Interface (Microsoft.Xrm.Sdk) | Microsoft Learn
IPluginExecutionContext2 Interface (Microsoft.Xrm.Sdk) | Microsoft Learn
IPluginExecutionContext3 Interface (Microsoft.Xrm.Sdk) | Microsoft Learn
IPluginExecutionContext4 Interface (Microsoft.Xrm.Sdk) | Microsoft Learn
Hi Radhika,
I think they might be running in a different context. Can you please share some more code details?
May it is because of the impersonation. For more details:
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148