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
+19-24Lines changed: 19 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
-
title: "Associate and disassociate entities using the Web API (Microsoft Dataverse)| Microsoft Docs"
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"
2
+
title: "Associate and disassociate tables using the Web API (Microsoft Dataverse)| Microsoft Docs"
3
+
description: "Read how to add a 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: 04/3/2021
5
+
ms.date: 05/03/2021
6
6
ms.service: powerapps
7
7
ms.suite: ""
8
8
ms.tgt_pltfrm: ""
@@ -22,11 +22,11 @@ search.app:
22
22
- D365CE
23
23
---
24
24
25
-
# Associate and disassociate entities using the Web API
25
+
# Associate and disassociate tables using the Web API
There are several methods you can use to associate and disassociate entities. Which method you apply depends on whether you’re creating or updating the entities and whether you’re operating in the context of the referenced entity or the referencing entity.
29
+
There are several methods you can use to associate and disassociate tables (entities). Which method you apply depends on whether you’re creating or updating the tables and whether you’re operating in the context of the referenced table or the referencing table.
30
30
31
31
<aname="bkmk_Addareferencetoacollection"></a>
32
32
@@ -85,7 +85,7 @@ OData-Version: 4.0
85
85
86
86
<aname="bkmk_Removeareferencetoanentity"></a>
87
87
88
-
## Remove a reference to an entity
88
+
## Remove a reference to a table
89
89
90
90
Use a DELETE request to remove a reference to an entity. The way you do it is different depending on whether you’re referring to a collection-valued navigation property or a single-valued navigation property.
91
91
@@ -124,27 +124,23 @@ OData-Version: 4.0
124
124
```http
125
125
HTTP/1.1 204 No Content
126
126
OData-Version: 4.0
127
-
```
128
-
129
-
130
-
127
+
```
131
128
132
-
133
129
<aname="bkmk_Associateentitiesoncreate"></a>
134
130
135
-
## Associate entities on create
131
+
## Associate tables on create
136
132
137
-
As described in [Associate entity records on create](create-entity-web-api.md#associate-entity-records-on-create), you can associate the new record to existing records by setting the navigation properties using the `@odata.bind` annotation.
133
+
As described in [Associate table rows on create](create-entity-web-api.md#associate-entity-records-on-create), you can associate the new record to existing records by setting the navigation properties using the `@odata.bind` annotation.
138
134
139
-
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*.
135
+
As described in [Create related tables in one operation](create-entity-web-api.md#bkmk_CreateRelated), new entities can be created with relationships using *deep insert*.
140
136
141
-
## Associate and disassociate entities on update
137
+
## Associate and disassociate tables on update
142
138
143
139
You can set the value of single-valued navigation properties using `PATCH` to associate or disassociate records.
144
140
145
141
<aname="bkmk_Associateentitiesonupdate"></a>
146
142
147
-
### Associate entities on update
143
+
### Associate tables on update
148
144
149
145
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.
150
146
@@ -169,7 +165,7 @@ HTTP/1.1 204 No Content
169
165
OData-Version: 4.0
170
166
```
171
167
172
-
### Disassociate entities on update
168
+
### Disassociate tables on update
173
169
174
170
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.
175
171
There are two ways to do this:
@@ -209,12 +205,12 @@ More information: [Basic update](update-delete-entities-using-web-api.md#basic-u
## Associate entities on update using collection-valued navigation property
208
+
## Associate tables on update using collection-valued navigation property
213
209
214
210
The following example shows how to associate multiple existing [ActivityParty](../reference/entities/activityparty.md) entities with an [Email](../reference/entities/email.md) entity using collection-valued navigation property `email_activity_parties`.
215
211
216
212
> [!NOTE]
217
-
> Associating multiple entities with an entity on update is a special scenario that is possible only with <xrefhref="Microsoft.Dynamics.CRM.activityparty?text=activityparty EntityType" />.
213
+
> Associating multiple entities with an entity on update is a special scenario that is possible only with <xref:Microsoft.Dynamics.CRM.activityparty?text=activityparty EntityType />.
218
214
219
215
**Request**
220
216
@@ -255,14 +251,13 @@ OData-Version: 4.0
255
251
[Perform operations using the Web API](perform-operations-web-api.md)
256
252
[Compose Http requests and handle errors](compose-http-requests-handle-errors.md)
257
253
[Query Data using the Web API](query-data-web-api.md)
258
-
[Create an entity using the Web API](create-entity-web-api.md)
259
-
[Retrieve an entity using the Web API](retrieve-entity-using-web-api.md)
260
-
[Update and delete entities using the Web API](update-delete-entities-using-web-api.md)
254
+
[Create a table using the Web API](create-entity-web-api.md)
255
+
[Retrieve a table using the Web API](retrieve-entity-using-web-api.md)
256
+
[Update and delete tables using the Web API](update-delete-entities-using-web-api.md)
261
257
[Use Web API functions](use-web-api-functions.md)
262
258
[Use Web API actions](use-web-api-actions.md)
263
259
[Execute batch operations using the Web API](execute-batch-operations-using-web-api.md)
264
260
[Impersonate another user using the Web API](impersonate-another-user-web-api.md)
265
261
[Perform conditional operations using the Web API](perform-conditional-operations-using-web-api.md)
Use a POST request to send data to create an entity. You can create multiple related entity records in a single operation using *deep insert*. You also need to know how to set values to associate a new entity record to existing entities using the `@odata.bind` annotation.
29
+
Use a POST request to send data to create a table row (entity record). You can create multiple related table rows in a single operation using *deep insert*. You also need to know how to set values to associate a new table row to existing tables using the `@odata.bind` annotation.
30
30
31
31
> [!NOTE]
32
-
> For information about how to create and update the entity metadata using the Web API, see [Create and update entity definitions using the Web API](create-update-entity-definitions-using-web-api.md).
32
+
> For information about how to create and update the table (entity) definitions using the Web API, see [Create and update table definitions using the Web API](create-update-entity-definitions-using-web-api.md).
To create a new entity record you must identify the valid property names and types. For all system entities and attributes, you can find this information in the topic for that entity in the [About the Entity Reference](../reference/about-entity-reference.md). For custom entities or attributes, refer to the definition of that entity in the [CSDL $metadata document](web-api-types-operations.md#csdl-metadata-document). More information: [Entity types](web-api-types-operations.md#entity-types)
70
+
To create a new entity record you must identify the valid property names and types. For all system entities and attributes (table columns), you can find this information in the topic for that entity in the [About the Table Reference](../reference/about-entity-reference.md). For custom entities or attributes, refer to the definition of that entity in the [CSDL $metadata document](web-api-types-operations.md#csdl-metadata-document). More information: [Entity types](web-api-types-operations.md#entity-types)
71
71
72
72
<aname="bkmk_createWithDataReturned"></a>
73
73
@@ -130,7 +130,7 @@ OData-Version: 4.0
130
130
131
131
<aname="bkmk_CreateRelated"></a>
132
132
133
-
## Create related entity records in one operation
133
+
## Create related table rows in one operation
134
134
135
135
You can create entities related to each other by defining them as navigation properties values. This is known as *deep insert*.
To associate new entities to existing entities when they are created you must set the value of navigation properties using the `@odata.bind` annotation.
By default, duplicate detection is suppressed when you are creating records using the Web API. You must include the `MSCRM.SuppressDuplicateDetection: false` header with your POST request to enable duplicate detection . Duplicate detection only applies when the organization has enabled duplicate detection, the entity is enabled for duplicate detection, and there are active duplicate detection rules being applied. More information: [Detect duplicate data using code](../detect-duplicate-data-with-code.md)
260
+
By default, duplicate detection is suppressed when you are creating records using the Web API. You must include the `MSCRM.SuppressDuplicateDetection: false` header with your POST request to enable duplicate detection. Duplicate detection only applies when 1) the organization has enabled duplicate detection, 2) the entity is enabled for duplicate detection, and 3) there are active duplicate detection rules being applied. More information: [Detect duplicate data using code](../detect-duplicate-data-with-code.md)
262
261
263
262
See [Detect duplicate data using Web API](manage-duplicate-detection-create-update.md#bkmk_create) for more information on how to check for duplicate records during Create operation.
264
263
265
264
<aname="bkmk_initializefrom"></a>
266
265
267
-
## Create a new entity record from another entity
266
+
## Create a new table row from another entity
268
267
269
268
Use `InitializeFrom` function to create a new record in the context of an existing record where a mapping exists between the entities to which the records belong.
270
269
@@ -295,7 +294,7 @@ Accept: application/json
295
294
}
296
295
```
297
296
298
-
The response received from `InitializeFrom` request consists of values of mapped attributes between the source entity and target entity and the GUID of parent record. The attribute mapping between entities that have an entity relationship is different for different entity sets and is customizable, so the response from `InitializeFrom` function request may vary for different entities and organizations. When this response is passed in the body of create request of the new record, these attribute values are replicated in the new record. The values of custom mapped attributes also get set in the new record during the process.
297
+
The response received from `InitializeFrom` request consists of values of mapped attributes between the source entity and target entity and the GUID of the parent record. The attribute mapping between entities that have an entity relationship is different for different entity sets and is customizable, so the response from `InitializeFrom` function request may vary for different entities and organizations. When this response is passed in the body of create request of the new record, these attribute values are replicated in the new record. The values of custom mapped attributes also get set in the new record during the process.
299
298
300
299
> [!NOTE]
301
300
> To determine whether two entities can be mapped, use this query:<br />
@@ -339,14 +338,13 @@ More information: [Access documents faster using storage partitions](azure-stora
339
338
[Perform operations using the Web API](perform-operations-web-api.md)<br />
340
339
[Compose Http requests and handle errors](compose-http-requests-handle-errors.md)<br />
341
340
[Query Data using the Web API](query-data-web-api.md)<br />
342
-
[Retrieve an entity using the Web API](retrieve-entity-using-web-api.md)<br />
343
-
[Update and delete entities using the Web API](update-delete-entities-using-web-api.md)<br />
344
-
[Associate and disassociate entities using the Web API](associate-disassociate-entities-using-web-api.md)<br />
341
+
[Retrieve a table using the Web API](retrieve-entity-using-web-api.md)<br />
342
+
[Update and delete tables using the Web API](update-delete-entities-using-web-api.md)<br />
343
+
[Associate and disassociate tables using the Web API](associate-disassociate-entities-using-web-api.md)<br />
345
344
[Use Web API functions](use-web-api-functions.md)<br />
346
345
[Use Web API actions](use-web-api-actions.md)<br />
347
346
[Execute batch operations using the Web API](execute-batch-operations-using-web-api.md)<br />
348
347
[Impersonate another user using the Web API](impersonate-another-user-web-api.md)<br />
349
348
[Perform conditional operations using the Web API](perform-conditional-operations-using-web-api.md)<br />
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/webapi/retrieve-and-execute-predefined-queries.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,8 +36,8 @@ Dataverse allows you to define, save, and execute two types of queries as listed
36
36
37
37
|Query type|Description|
38
38
|----------------|-----------------|
39
-
|**Saved Query**|System-defined views for an entity. These views are stored in the <xref:Microsoft.Dynamics.CRM.savedquery?text=savedquery EntityType />. More information: [Customize table views](../../model-driven-apps/customize-entity-views.md)|
40
-
|**User Query**|Advanced Find searches saved by users for an entity. These views are stored in the <xref:Microsoft.Dynamics.CRM.userquery?text=userquery EntityType />. More information: [UserQuery (saved view) table](../saved-queries.md)|
39
+
|**Saved Query**|System-defined views for a table (entity). These views are stored in the <xref:Microsoft.Dynamics.CRM.savedquery?text=savedquery EntityType />. More information: [Customize table views](../../model-driven-apps/customize-entity-views.md)|
40
+
|**User Query**|Advanced Find searches saved by users for a table (entity). These views are stored in the <xref:Microsoft.Dynamics.CRM.userquery?text=userquery EntityType />. More information: [UserQuery (saved view) table](../saved-queries.md)|
41
41
42
42
Records for both of these types of entities contain the FetchXML definition for the data to return. You can query the respective entity type to retrieve the primary key value. With the primary key value, you can execute the query by passing the primary key value. For example, to execute the **Active Accounts** saved query, you must first get the primary key using a query like this.
43
43
@@ -51,7 +51,7 @@ You can then use the `savedqueryid` value and pass it as the value to the savedQ
51
51
GET [Organization URI]/api/data/v9.0/accounts?savedQuery=00000000-0000-0000-00aa-000010001002
52
52
```
53
53
54
-
Use the same approach to get the userqueryid and pass it as the value to the `userQuery` parameter to the entity set that matches the corresponding `returnedtypecode` of the saved query.
54
+
Use the same approach to get the `userqueryid` and pass it as the value to the `userQuery` parameter to the entity set that matches the corresponding `returnedtypecode` of the saved query.
55
55
56
56
```http
57
57
GET [Organization URI]/api/data/v9.0/accounts?userQuery=121c6fd8-1975-e511-80d4-00155d2a68d1
@@ -159,7 +159,7 @@ A paging cookie must be requested as an annotation. Set the `odata.include-annot
159
159
160
160
<aname="bkmk_FetchXMLwithinBatch"></a>
161
161
162
-
### Use FetchXML within a Batch request
162
+
### Use FetchXML within a batch request
163
163
164
164
The length of a URL in a `GET` request is limited. Including FetchXML as a parameter in the URL can reach this limit. You can execute a `$batch` operation using a `POST` request as a way to move the FetchXML out of the URL and into the body of the request where this limit will not apply. More information:[Execute batch operations using the Web API](execute-batch-operations-using-web-api.md).
165
165
@@ -232,15 +232,14 @@ OData-Version: 4.0
232
232
[Perform operations using the Web API](perform-operations-web-api.md)<br />
233
233
[Compose Http requests and handle errors](compose-http-requests-handle-errors.md)<br />
234
234
[Query Data using the Web API](query-data-web-api.md)<br />
235
-
[Create an entity using the Web API](create-entity-web-api.md)<br />
236
-
[Retrieve an entity using the Web API](retrieve-entity-using-web-api.md)<br />
237
-
[Update and delete entities using the Web API](update-delete-entities-using-web-api.md)<br />
238
-
[Associate and disassociate entities using the Web API](associate-disassociate-entities-using-web-api.md)<br />
235
+
[Create a table using the Web API](create-entity-web-api.md)<br />
236
+
[Retrieve a table using the Web API](retrieve-entity-using-web-api.md)<br />
237
+
[Update and delete tables using the Web API](update-delete-entities-using-web-api.md)<br />
238
+
[Associate and disassociate tables using the Web API](associate-disassociate-entities-using-web-api.md)<br />
239
239
[Use Web API functions](use-web-api-functions.md)<br />
240
240
[Use Web API actions](use-web-api-actions.md)<br />
241
241
[Execute batch operations using the Web API](execute-batch-operations-using-web-api.md)<br />
242
242
[Impersonate another user using the Web API](impersonate-another-user-web-api.md)<br />
243
243
[Perform conditional operations using the Web API](perform-conditional-operations-using-web-api.md)<br />
0 commit comments