When updating lookup values, or using lookups in entities you must use the @odata.bind annotation to set the value.
The syntax for this is: {field_name@odata.bind: “/entitypluralname(guid)”}
Some examples:
- ownerid@odata.bind:”/systemusers(a30cbf7b-69cd-4299-b468-b4978f716af7)”
- opportunityid@odata.bind: “/opportunities(a30cbf7b-69cd-4299-b468-b4978f716af7)”
For lookups that have different possible entity types(i.e regardingobjectid), this changes slightly (note the entity logical name at the end of the “name”)
- parentcustomerid_account@odata.bind = “/accounts(a30cbf7b-69cd-4299-b468-b4978f716af7)”
Hope this helps 😊
One thought on “Dynamics 365 Web Api – How to Set Lookup Field Value”