Create a child record by copying mapping fields data from Parent – Using CRM SDK
InitializeFromRequest initialize = new 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(“D4CBEE74-B5E3-E611-8109-C4346BDD8041”));
// 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”, “Rajeev”);
entContact.Attributes.Add(“lastname”, “Pentyala”);
// Create a new contact
orgService.Create(entContact);
Thanks to Rajeev, please find URL below to the original post
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.