web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How do I compare json ...
Power Automate
Answered

How do I compare json to lists and find if there are records ?

(0) ShareShare
ReportReport
Posted on by 2

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.

 

Capture.PNG

Categories:
  • Verified answer
    v-litu-msft Profile Picture
    Microsoft Employee on at

    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:

    Screenshot 2020-10-19 113643.jpg

     

    Screenshot 2020-10-19 113703.jpg

     

    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.

  • WayneSingh Profile Picture
    14 on at
    This helped me a lot in my current Flow thank you 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 331 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard