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 
}