Hello All,
I have a task to create a Businessunit with the value of name field in custom entity, and need to update the created business unit value in lookup while creating the custom entity record.
I am able to create businessunit record, but update the created businessunit value in lookup is not working.
Below is the code for that. Please let me know where i am wrong.
public static Guid UpdateBusinessUnit(IOrganizationService _service, Guid _businessUnitid, Entity _customEntity) { Entity _updateEntiy = new Entity(_customEntity.LogicalName); _updateEntiy.Id = _customEntity.Id; _updateEntiy["new_BusinessUnit"] = new EntityReference("BusinessUnit", _businessUnitid); _service.Update(_updateEntiy); return _updateEntiy.Id; }Kumar R