Hi,
I have a json list with clients from another system, this i want to add to the Contact in Dynamics 365 if they don't exists. If they do, i want to update the records. Somehow i'm not able to get the loops to work or getting the criterias to match. I'm using eksternalid in Contact and similiar a wp_user_id in the json. Can somebody help ?? Been stuck for 4-5 hours now.
Hi @mirzam,
Please not update a record or create a new record in the first condition action. The first condition simply determines whether an item in the ListA matches an item in the ListB, but there may be other item matches in the ListB. So it is unwise to decide whether to update record or add record in a single judgment, which can result in a large number of duplicate item being created.
You can initialize an integer variable called Flag, to set the initial value of 0. It means no item match was found. In the inner loop, if the ListA matches any item, in the ListB, the Flag is set to 1. Then, after the end of the memory loop, create a second Condition action, to determine whether the value of Flag is 1. If it is 1, then restore the Flag to the original value after the update record, update so that the next external loop. If it is 0, it means that there is no value in the ListB to match it, and then add record.
Here is an example:
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492