Set value into lookup field in console app using dynamic CRM 365
Entity recordToUpdate = service.Retrieve("contact", contactId, new ColumnSet(true)); recordToUpdate["parentcustomerid"] = new EntityReference("account", accountId); service.Update(recordToUpdate);
Here is what the above code is Doing:
1. Retrieve the contact record using the contactId variable.
2. Create a new EntityReference object using the accountId variable.
3. Set the parentcustomerid attribute of the contact record to the EntityReference object.
4. Update the contact record.