Michael Philip's Blog

Writing about MS Tech with strong focus on Azure & CRM

Leave a comment

Trigger plugin on Action Execution in Dynamics CRM

Hi ,

I am going  to show in the following steps how to trigger plugin on Action execution in CRM 2013/2015


1) Create Action


2) Register plugin


3) Call Action

The following code will show how to call the action using C#

OrganizationRequest callActionRequest = new OrganizationRequest("qdrn_setcustomervip");

callActionRequest[“Target”] = new EntityReference(“contact”, {GUID});

OrganizationResponse callActionResponse = service.Execute(callActionRequest);


Leave a comment

Plugin doesn’t run while importing data

This problem is due to checking for depth in plugin, the async job that inserts imported data into CRM

sets plugin depth to ‘2’, so the solution is to disable check for depth while data import.

Leave a comment

MS CRM 2011 -Get a Refrence to an Instance of Organization Service Inside Plugins

public void Execute(IServiceProvider serviceProvider)

// Obtain the execution context from the service provider.

IPluginExecutionContext context = (IPluginExecutionContext)

// Obtain the organization service reference.

IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);