
MS Dynamics Web API Quirks: The Strange Case of Polymorphic Fields
If you’ve ever integrated with Microsoft Dynamics 365 / Dataverse , you probably noticed something odd almost immediately. You read a record and see fields like this: { "_ownerid_value" : "151F639c-1c73-eb11-b1ab-000d3a253b40" } But when creating or updating records, the API suddenly expects something like: { "ownerid@odata.bind" : "/systemusers(151F639c-1c73-eb11-b1ab-000d3a253b40)" } And if the field is polymorphic, sometimes the property name changes again: { "parentcustomerid_account@odata.bind" : "/accounts(ce9eaaef-f718-ed11-b83e-00224837179f)" } Welcome to one of the most confusing parts of the Dynamics Web API: lookup and polymorphic fields . Let’s unpack what’s going on. What are polymorphic fields in Dynamics? Some relationships in Dynamics can point to multiple entity types. Example metadata: { "LogicalName" : "ownerid" , "Targets" : [ "systemuser" , "team" ] } This means a record owner can be: A system user A team Other examples of polymorphic lookups include: Field Possibl
Continue reading on Dev.to
Opens in a new tab



