我有一个插件,当联系人更新时会触发。当两个联系人合并时,这也会被触发。确定联系人是否已在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
....
}
答案 0 :(得分:2)
请尝试以下操作:
if (localContext.PluginExecutionContext.ParentContext != null &&
localContext.PluginExecutionContext.ParentContext.MessageName == "Merge")
{
//When records are merged
}
else
{
//All other cases
}