Understanding IPluginExecutionContext

IPluginExecutionContext can be considered the heart of a plug-in assembly because it supplies all the required information to the plug-in. It contains all the CRM context information, such as the entity the plug-in is executing, the user who is responsible for plug-in execution, and various input and output parameters with other related information. We can get IPluginExectuionCotext from IServiceProvider, as follows:

public void Execute(IServiceProvider serviceProvider)
{
  // Obtain the execution context
  IPluginExecutionContext context = (IPluginExecutionContext)
  serviceProvider.GetService(typeof(IPluginExecutionContext));
}

It contains many members that help us to get information for our plug-in. The following ...

Get Microsoft Dynamics CRM 2015 Application Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.