Dynamics CRM - 确定联系人是否已合并到 PreContactUpdate 插件中
Dynamics CRM - Identifying whether a Contact has been merged in a PreContactUpdate plugin
我有一个插件可以在联系人更新时触发。当两个联系人合并时,这也会被触发。识别联系人是否已在 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
....
}
尝试以下操作:
if (localContext.PluginExecutionContext.ParentContext != null &&
localContext.PluginExecutionContext.ParentContext.MessageName == "Merge")
{
//When records are merged
}
else
{
//All other cases
}
我有一个插件可以在联系人更新时触发。当两个联系人合并时,这也会被触发。识别联系人是否已在 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
....
}
尝试以下操作:
if (localContext.PluginExecutionContext.ParentContext != null &&
localContext.PluginExecutionContext.ParentContext.MessageName == "Merge")
{
//When records are merged
}
else
{
//All other cases
}