Dynamics CRM-标识联系人是否已在PreContactUpdate插件中合并

问题描述 投票:1回答:1

我有一个插件,当联系人更新时会触发。当两个联系人合并时也会触发此事件。识别联系人是否已在PreContactUpdate插件中合并的最简单方法是什么?

代码:

    protected void ExecutePreContactUpdate(LocalPluginContext localContext)
    {
        if (localContext == null)
        {
            throw new ArgumentNullException("localContext");
        }

        Entity contact = (Entity)localContext.PluginExecutionContext.InputParameters["Target"];

        // check if contacts have been merged
        ....
    }
c# plugins dynamics-crm-2011 microsoft-dynamics dynamics-crm-2015
1个回答
2
投票

尝试以下操作:

if (localContext.PluginExecutionContext.ParentContext != null &&
localContext.PluginExecutionContext.ParentContext.MessageName == "Merge")
{
//When records are merged
}
else
{
//All other cases
}
© www.soinside.com 2019 - 2024. All rights reserved.