Quantcast
Viewing all articles
Browse latest Browse all 286

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"] isEntityReference)
{
       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, newColumnSet(newstring[] {  }));

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

Hope this helps

--
Happy CRM'ing
Gopinath

Viewing all articles
Browse latest Browse all 286

Trending Articles