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 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
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
Thank you very much for this post. I was looking exactly for this !!! Good work !!
ReplyDelete