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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get the lasts 2...
Power Automate
Unanswered

How to get the lasts 2 versions and what columns has been changed

(0) ShareShare
ReportReport
Posted on by 42

Hello everyone,

 

I need help with my scenario, I ran a flow to update all my 3000 items in the list which caused the issue that I am having right now.

I need to undo the last flow run that I made, I have to get all the items in my list to be reverted back to the previous versions before I mistakenly ran the flow I made.

 

I need help on how to get the last 2 versions, the latest version is the one where I made the mistake, and the previous version is the correct version where all the values of the status column are correct. I need to get the columns where the values where changed because I am not sure which other columns has to be reverted back to its previous values aside from the status column. Is this possible?

 

If I can get the column names its new and old values, then revert back to its old values it would be great. Right now, my last option is to do the version history in every item manually. Please help.

Categories:
I have the same question (0)
  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @heyjay  ,

     

    You can use the Send an HTTP Request to SharePoint action in Power Automate to get the versions of your SP List.

    Also you can use the action Get changes for an item or a file (properties only) to know the changes in the column.

     

    Please checkout the below thread for a detailed post.

    https://www.catapultsystems.com/blogs/get-previous-versions-of-sharepoint-list-items-in-flow/

     

    If this helps , please give this a thumbs up and accept it as a solution.

     

    Thanks,

  • heyjay Profile Picture
    42 on at

    Hi @SanmeshG ,

     

    Appreciate your response, however in the given post, the flow starts with "When an Item is created or modified", I can't have that as a trigger since the change has already been made and I need to restore the changes back to the previous version. Is that possible?

  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @heyjay  ,

     

    Yes that should be possible. For each Item in SP List , you have to calculate the previous version of the item and update the values.

     

    So your flow can be a manual flow.

     

    1. Manual Trigger.

    2. Get Items

    3. Send an HTTP Action to get Version History inside an apply to each loop

    4. Get Results Array and check if the length is greater than 1(using Parse JSON), If yes

     4.1. Get the most recent version and subtract 1

     4.2 Update the item in the SP List using the columns from Filter array action(see screenshots)

     

    Screenshot (503).pngScreenshot (504).png

     

    I am not sure if there is any other shortcut method.

     

    If this helps , please give this a thumbs up and accept this as a solution.

     

    Thanks,

  • heyjay Profile Picture
    42 on at

    Hi @SanmeshG ,

     

    Appreciate your help on this, I will try your solution and will get back to you.

  • heyjay Profile Picture
    42 on at

    Hello @SanmeshG ,

     

    I am stuck with Parse JSON action, I tried using the Results Array in the Content part of Parse JSON and the Schema is from the Results Array Output, am I doing something wrong?

  • heyjay Profile Picture
    42 on at

    Hi @SanmeshG ,

     

    Can you please expand the Results Array, Parse JSON, Length of Results Array so I can see exactly what is the syntax you used, and also are those "Compose" action? Sorry, I'm new to this.

  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @heyjay  ,

     

    You can do it without the Parse JSON action as well. 

     

    Please add a compose action and use the below expression.

    outputs('Results_Array')[0]?['versionLabel']

     Now based on this you can have a condition. 

     

    The output of the above Compose action can be used in condition to decide whether the item should be restored or not. It it returns 1.0 then you need not update else you update.

     

    Hope this solves your issue.

     

    Thanks,

    Sanmesh

  • heyjay Profile Picture
    42 on at

    Hi @SanmeshG ,

     

    I'm sorry but I am confused now, I replaced the old Parsed JSON action with the one you mentioned, I created a compose action with this expression: 

    outputs('Results_Array')[0]?['versionLabel']

    and now, I get an error with the Get Latest Version compose action.

     

  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @heyjay  ,

     

    Can you share the screenshots of your flow , you have to remove the Parse JSON action completely. And also , the Length of Results Array(see Screenshot 2). In the condition you will use the above expression and match it with 1.0 with condition set to not equal to.

     

    And it should work.

  • heyjay Profile Picture
    42 on at

    Hi @SanmeshG ,

     

    Here you go:

    part1.pngpart2.png

     

    This was the original flow I made.

    Then I changed it according to your instructions:

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard