Merge table rows using the Web API
Note
Unsure about entity vs. table? See Developers: Understand terminology in Microsoft Dataverse.
When you find duplicate records you can combine them into one using the Merge Action.
Merge action
Merge is an unbound action that accepts four parameters:
| Name | Type | Description |
|---|---|---|
Target |
crmbaseentity | The target of the merge operation. |
Subordinate |
crmbaseentity | The entity record from which to merge data. |
UpdateContent |
crmbaseentity | Additional entity attributes to be set during the merge operation. |
PerformParentingChecks |
Boolean | Indicates whether to check if the parent information is different for the two entity records. |
All the parameters are required.
Use a POST request to send data to merge entities. This example merges two account entity records while updating accountnumber property of the record that will remain after the merge.
Request
POST [Organization URI]/api/data/v9.0/Merge HTTP/1.1
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0
Accept: application/json
{
"Target": {
"name": "Account 1",
"accountid": "bb8055c0-aea6-ea11-a812-000d3a55d474",
"@odata.type": "Microsoft.Dynamics.CRM.account"
},
"Subordinate": {
"name": "Account 2",
"accountid": "c38055c0-aea6-ea11-a812-000d3a55d474",
"@odata.type": "Microsoft.Dynamics.CRM.account"
},
"UpdateContent": {
"accountnumber": "1234",
"@odata.type": "Microsoft.Dynamics.CRM.account"
},
"PerformParentingChecks": false
}
Important
Because the Target, Subordinate, and UpdateContent property types are not explicitly defined by the parameter, you must include the @odata.type annotation to specify the type.
Response
HTTP/1.1 204 No Content
OData-Version: 4.0