CRM do not support direct update of Entity Reference properties, Use Navigation properties instead

后端 未结 2 801
南方客
南方客 2021-02-14 06:00

I am using Ms Dynamic Web Api with Simple OData. I need to add new record for link entities.

I am using the below code snip and refer the documentation on https://githu

2条回答
  •  不知归路
    2021-02-14 06:17

    Well, it is possible, but you need to use the special "@odata.bind" syntax to update your single-navigation properties.

    For example, to update an account so that it references an existing primarycontactid, you can use a PATCH operation to the /api/data/v8.2/accounts endpoint with the following body:

    {
       "name":"Sample Account",
       "primarycontactid@odata.bind":"/contacts(00000000-0000-0000-0000-000000000001)"
    }
    

    See https://msdn.microsoft.com/en-us/library/gg328090.aspx#Anchor_3 (it is discussed in terms of creating an entity, but it works for updating as well).

提交回复
热议问题