How to merge Dataverse records
This blog will show you how you can use the Perform an unbound action to merge two Microsoft Dataverse records within a Power Automate flow. In this example I will use two records from the Accounts table from Dynamics 365 Sales.
I was triggered by the comment from ChrisWP below.
I am trying to use “Perform an unbound action” in a Power Automate to merge two contact records and struggling with the parameters required.
Power Users Community thread: Perform an unbound action – Merge – How to use.
Merging records is always an interesting scenario and also a great reason to look into the details of the Perform and unbound action.
If you want to know how a merge action works it is a good idea to go to the interface first. When you merge two records in the interface you will get a dialog like below.
As you can see you can select a target and you can specify which fields you want to keep. This is useful to know for the Power Automate action configuration.
1. Add a Manually trigger a flow trigger action.
2. Add a Get row by ID action. Use the Account GUID to retrieve the first account record. This will be the Target record.
3. Add another Get row by ID action. Use the Account GUID to retrieve the second account record. This will be the subordinate.
4. Add a Perform an unbound action. Select the Merge action. Use the configuration of below.
In the action you have the same type of configuration as in the interface. You can specify a target and a subordinate. And you can specify which fields you want to update. In the example below we are only updating the name.
Also notice the double @ characters before the odata.type field. This is to escape the single @ character and make the json valid.
Testing the merge
When you run the flow you should get a result like below. As you can see subordinate is deactivated and there is a notification that it is merged into the target record.
Will this process wort with custom entity data? I would assume so since its dataverse records, right?
Unfortunately, the merge feature (also in the interface) is only available for the Account, Lead & Contact tables/entities :
Rule of thumb, if you can merge it in the interface you can merge it via this Dataverse action 🙂
Thanks Dennis! That is what I figured 🙂