1

我有一個插件在聯繫人更新時觸發。當兩個聯繫人合併時,這也會被觸發。識別聯繫人是否已在PreContactUpdate插件中合併的最簡單方法是什麼?動態CRM - 識別聯繫人是否已被合併到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 
     .... 
    } 

回答

2

嘗試以下操作:

if (localContext.PluginExecutionContext.ParentContext != null && 
localContext.PluginExecutionContext.ParentContext.MessageName == "Merge") 
{ 
//When records are merged 
} 
else 
{ 
//All other cases 
} 
相關問題