Skip to main content

Notifications

Bengaluru or Bangalore Dynamics 365 User Grup ...

Bengaluru or Bangalore Dynamics 365 User Grup

Posted on by 20

Hi,

I am trying to get and set the lookup on create of account create contact with same lookup values, all the fields are getting mapped except the lookup field values. Kindly find the below mentioned code and correct me if my code is wrong.

Entity Account = (Entity)context.InputParameters["Target"];
EntityReference ContactLookup = Account.GetAttributeValue<EntityReference>("new_contactlookup");
var LookupId = ContactLookup.Id;
var logicalName = ContactLookup.LogicalName;

Entity Contact = new Entity("contact");
Contact["cr04d_accountlookup"] = new EntityReference(logicalName, LookupId);

Regards,

Sultan from Bangalore