Dynamics 365 Web Api – How to Set Lookup Field Value

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 = … Continue reading Dynamics 365 Web Api – How to Set Lookup Field Value

How to Set Lookup Field Value Using JavaScript -Dynamics 365

To set a lookup field value, you need 3 parameters. Id of the lookup recordname of the lookup recordentity name of the lookup entity Here is how to use these values to set an account lookup field. var lookupValue = new Array();lookupValue[0] = new Object();lookupValue[0].id = myAccountId;lookupValue[0].name = myAccountName;lookupValue[0].entityType = "account";Xrm.Page.getAttribute("mylookupfield").setValue(lookupValue);

Dynamics 365 Multi-table lookups

Multi-table lookups, are now finally live (Preview) for use via API or SDK. Multi-table lookups (polymorphic lookups) allow the creation of a lookup in one table that looks up records in multiple other tables at once. This provides much greater flexibility in retrieving data within your environments. Let's imagine we have many different objects that … Continue reading Dynamics 365 Multi-table lookups