Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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

  • WayneSingh Profile Picture
    14 on at
    Re: How do I compare json to lists and find if there are records ?
    This helped me a lot in my current Flow thank you 🙂
  • Verified answer
    v-litu-msft Profile Picture
    on at
    Re: How do I compare json to lists and find if there are records ?

    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.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492