Saturday, 9 January 2016

Plugin on Merge message in CRM

Hi,
 
Recently, we had a to write a plugin on merge message in CRM. We need to perform some activity based on merged records(Master and Subordinate).
 
Here is the C# code to get the Master and Subordinate entity reference in the plugin code.
 
if (pluginContext.InputParameters.Contains("Target") && pluginContext.InputParameters["Target"] is EntityReference)
{
       EntityReference entityReferenceMaster = (EntityReference)pluginContext.InputParameters["Target"];
       Guid guidSubOrdinate = (Guid)pluginContext.InputParameters["SubordinateId"];

       // Get Master record information. Specify the attributes which you want to retrieve
       Entity entMasterAccount = crmService.Retrieve("account", entityReferenceMaster.Id, new ColumnSet(new string[] {  }));

       // Get Subordinate record information. Specify the attributes which you want to retrieve
       Entity entOrphanAccount = crmService.Retrieve("account", guidSubOrdinate, new ColumnSet(new string[] { }));
}

Hope this helps

--
Happy CRM'ing
Gopinath

1 comment:

  1. The Best CRM Software are all effective and tough making sure that your business gets the necessary demand all fulfilled thereby taking into count all features necessary for your management. The website is professionally designed making sure business owners can get the basic task completed within simple and effective ways. The online CRM software is worth enough for use and can be bought by any business from genuine service providers.

    ReplyDelete