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 / Add or Update Datavers...
Power Automate
Answered

Add or Update Dataverse Row

(0) ShareShare
ReportReport
Posted on by 21

Hello. I am trying to update a dataverse row with a condition stating that two specific values match. If there is a match, update the row. If they don't, add a new row. When I run this workflow, it updates every row to the same item.

amg92_0-1703200120250.png 

amg92_1-1703200137847.png

 

 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @amg92 ,

     

    The logic of your flow is incorrect. It compares all rows of Dataverse table with each item in the array output from Parse JSON. What you need instead is a Filter array, for each array from Parse JSON, Filter the Dataverse table, in the Condtion control if one item matches the output (length('Filter_array') = 1), update current row (Apply_to_each will come up automatically), otherwise add a new row.

     

    Best regards,

  • amg92 Profile Picture
    21 on at

    What does the Filter array and filtering the dataverse table look like?

    amg92_0-1703264865921.png

     

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @amg92 ,

     

    This is the basic steps in your flow. I don't have a table and JSON array as yours to test with, so, it's just a demonstration:

    vjefferni_0-1703471568022.png

     

    In Apply to each, its input is body('Parse_JSON'), and in filter array, you need to write expression to set the two

    conditions:

    vjefferni_1-1703471715922.png

     

    vjefferni_2-1703471831765.png

    @and(equals(item()['Column1'], items('Apply_to_each')['Column1']),equals(item()['Column2'], items('Apply_to_each')['Column2']))

     

    In Condition, the expression is:

    length(body('Filter_array'))   is equal to  1

     

    In Apply to each to, the array it's from is body('Filter_array')

     

    Best regards,

  • amg92 Profile Picture
    21 on at

    I've updated my workflow to match what you have above and I am still getting the same result. The workflow continues to add additional rows instead of updating a row in a Dataverse table. For example: row "1212" in the dataverse table states the item is "rejected." If this status changes to "approved," I want to update row "1212" in the dataverse instead of adding an additional row.

     

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @amg92 ,

     

    Please share a screenshot about your current Filter array and the Condition control.

     

    Best regards,

  • amg92 Profile Picture
    21 on at

    Filter array: @And(equals(item()?['blank_sownumber'], items('Apply_to_each')?['sow-number']),equals(item()?['blank_approvalstep'], items('Apply_to_each')?['approval-step']))

    • amg92_1-1704297411477.png
    • Condition
      • amg92_2-1704297455018.png

         

     

    amg92_0-1704297297939.png

     

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @amg92 ,

     

    How many items are there in Filter array result? It may be more than 1 so please try and change the condition to larger than 0.

     

    Best regards,

  • amg92 Profile Picture
    21 on at

    Within the apply to each loop there are lots of results. Below is a screenshot.

    amg92_0-1704410136092.png

     

    I tried changing the condition to greater than 0 and it has been running for 5 hours now. It did update the rows properly and it appears to not be duplicating rows anymore, but seems to be stuck in a loop.

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @amg92 ,

     

    You have 2268 rows in the ParseJSON outcome. Is it correct?

     

    Best regards,

  • amg92 Profile Picture
    21 on at

    Yes, that is correct. Which can be filtered to rows where column X has a date within the last 24 hours or 48 hours to reduce the length of time. I have not found a good way to filter a dynamic date

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 77 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 68

#3
Expiscornovus Profile Picture

Expiscornovus 56 Most Valuable Professional

Last 30 days Overall leaderboard