You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/webapi/associate-disassociate-entities-using-web-api.md
+75-26Lines changed: 75 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Associate and disassociate entities using the Web API (Microsoft Dataverse)| Microsoft Docs"
3
3
description: "Read how to add reference to a collection-valued navigation property, remove a reference and change an existing reference using the Web API"
4
4
ms.custom: ""
5
-
ms.date: 10/31/2018
5
+
ms.date: 04/3/2021
6
6
ms.service: powerapps
7
7
ms.suite: ""
8
8
ms.tgt_pltfrm: ""
@@ -21,6 +21,7 @@ search.app:
21
21
- PowerApps
22
22
- D365CE
23
23
---
24
+
24
25
# Associate and disassociate entities using the Web API
As described in [Create related entities in one operation](create-entity-web-api.md#bkmk_CreateRelated), new entities can be created with relationships using *deep insert*.
130
138
139
+
## Associate and disassociate entities on update
140
+
141
+
You can set the value of single-valued navigation properties using `PATCH` to associate or disassociate records.
142
+
131
143
<aname="bkmk_Associateentitiesonupdate"></a>
132
144
133
-
## Associate entities on update using single-valued navigation property
145
+
###Associate entities on update
134
146
135
147
You can associate entities on update using the same message described in [Basic update](update-delete-entities-using-web-api.md#bkmk_update) but you must use the @odata.bind annotation to set the value of a single-valued navigation property. The following example changes the account associated to an opportunity using the `customerid_account` single-valued navigation property.
You can remove a reference to a single-valued navigation property when updating by setting the value to `null`. This method allows you to disassociate multiple references in a single operation.
173
+
There are two ways to do this:
174
+
175
+
You can set the value to `null` using the `@odata.bind` annotation:
> See [Associate entities on update](associate-disassociate-entities-using-web-api.md#bkmk_Associateentitiesonupdate) for information about associating entities on update.
76
+
> See [Associate and disassociate entities on update](associate-disassociate-entities-using-web-api.md#associate-and-disassociate-entities-on-update) for information about associating and disassociating entities on update.
0 commit comments