2014-04-01 3 views
2

다른 엔터티에 대한 참조가있는 조직 서비스를 통해 엔터티를 만들 수 있습니다. 조직 서비스를 통해이 엔티티 관계에 대한 필드 매핑을 트리거하여 필요한 모든 데이터가 해당 관계에 대한 inbuilt 매핑을 통해 추출되도록하는 방법이 있습니까?Dynamics CRM 2013의 엔터티간에 필드를 매핑하는 방법

매핑을 통해 데이터를 채울 것으로 예상되는 해당 엔티티에서 실행되는 POST 작성 플러그인이 있어야합니다.

+0

당신이 동적으로 엔티티가 올바른 다른 테이블의 데이터로 미리 채워 할 _AND_ 개체를 만드는 것 소리? 우리는 여러 줄 또는 하나만 이야기하고 있습니까? 보안 문제로 인해이 작업을 수행하고 있습니까? – Eccountable

+0

+1, 매우 흥미로운 질문 –

답변

1

다른 사람이 당신을 위해 코드를 작성 : 당신이 프론트 엔드 CRM 2011 년까지 기존 개체의 자식 개체를 만들 때

http://code.msdn.microsoft.com/Automatic-mapping-of-child-9df6db11

자동으로 경우 일부 필드 매핑 엔티티 맵 이 해당 관계에 존재합니다. 그러나 을 통해 자식 엔티티를 만들면 아무 일도 발생하지 않습니다. 이 예제에서는 에 대한 솔루션을 제공하려고 시도합니다.

0

이 기능을 사용하려면 InitializeFromRequest를 사용해야합니다.

InitializeFromRequest initialize = new InitializeFromRequest(); 

// Set the target entity (i.e.,Contact) 
initialize.TargetEntityName = "contact"; 

// Create the EntityMoniker of Source (i.e.,Account) 
initialize.EntityMoniker = new EntityReference("account", new Guid("<GUID>")); 

// Execute the request 
InitializeFromResponse initialized = (InitializeFromResponse)orgService.Execute(initialize); 

// Read Intitialized entity (i.e.,Contact with copied attributes from Account) 
if (initialized.Entity != null) 
{ 
// Get entContact from the response 
Entity entContact = initialized.Entity; 

// Set the additional attributes of the Contact 
entContact.Attributes.Add("firstname", "abc"); 
entContact.Attributes.Add("lastname", "xyz"); 

// Create a new contact 
orgService.Create(entContact); 
} 

https://rajeevpentyala.com/2017/01/26/create-a-child-record-by-copying-mapping-fields-from-parent-using-crm-sdk/

관련 문제