Developers can use the IPluginExecutionContext service object to obtain contextual information from the CRM platform which is passed to the plugin at run-time. It includes details about the user who triggered the plugin event as well as transactional information handled at the platform layer. In this post, we will see which properties are available to obtain information about an organization.
The IPluginExecutionContext object includes the following GUID properties:
The OrganizationId property returns the GUID for the CRM organization that the plugin is currently registered against. This property is useful in situations where you have a custom integration with a third-party application where you might be synchronizing data back and forth. The OrganizationId property can help distinguish between different CRM systems if the third-party application is to be integrated with multiple CRM organizations
The OrganizationName property returns the name of your CRM organization. The name returned matches the name which is specified under Developer Resources in the Customizations area.
There are many more useful properties available via the IPluginExecutionContext. In my next post, we will take a look at how we can obtain information about the entity record from where a plugin was executed.