I am trying to use "Perform an unbound action" in a Power Automate to merge two contact records and struggling with the parameters required.
The Microsoft documentation suggests the following:
However I don't know how to translate this to what Power Automate requires. This is my current configuration. There doesn't appear to be any documentation for this.
Hi @Expiscornovus !
I have to merge clients with several fields and the conditions that ChrisWP mentioned. How do you suggest doing the merge with the "different collection functions"? I saw Microsoft page but it's not a "tutorial" kind of page and the information is very basic. Can you illuminate me or guide me?
Thanks in advance,
FSO
Hi @ChrisWP,
You can probably use a couple of empty functions to compare the two fields values and append the value to a separate string variable.
This will still be manageable if we are only talking about 4 fields.
Below is an example expression for this approach:
if(empty(outputs('Get_a_row_by_ID_-_Account1')?['body/description']), if(empty(outputs('Get_a_row_by_ID_-_Account2')?['body/description']), '', concat('"description": "', outputs('Get_a_row_by_ID_-_Account2')?['body/description'], '"')), concat('"description": "', outputs('Get_a_row_by_ID_-_Account1')?['body/description'], '"'))
If you want to do this for all the fields of the record I wouldn't recommend this approach. Than it is probably better to have a look at the different collection functions like union, intersection, etc.:
I have a new requirement with this to check for empty fields and populate the UpdateContext based on one or the other record.
For example,
Field 1: Target has no data in this field but Subordinate does. I want the subordinate value.
Field 2: Target has data and Subordinate does not. I want to keep the target value.
Field 3: Target has data and Subordinate has data. I want to keep target data.
Field 4: Target has no data and Subordinate has no data. I do not want to update this field.
I have tried writing an if statement to handle this but it does not work because you always have to have 3 parameters in if, in the situation where there is no data at all, the Merge action throws an error because I'm passing null.
Hi @ChrisWP,
That is definitely a gotcha in Power Automate. You always need to escape the @ character in the json with another @ character 😁
Perfect thank you, I was missing the double @@ in a previous attempt. Thanks so much.
Hi @ChrisWP,
I tested a couple of things and also had a look at the Web API documentation:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/merge-entity-using-web-api
Can you try the below approach? In this example I am only merging the name field btw.
Normally in the interface you can also select the other fields. You need to specify those in your UpdateContent field as well.