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

Community site session details

Session Id : YfzH+m12oQ0GKgp2mJLeDy
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 17 Oct 2020 04:13:30 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 19 Oct 2020 at 05:20:56
    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 19 Oct 2020 at 03:38:35
    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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete