2

Is there a way to roll back a changed item in a list due to the rejection in the approval process?

Seems an item would not roll back to its previous state if an approve reject the changes due to the approval process.

3 Answers 3

2

You can as long as you have Version History turned on for the list. While it is not a built-in function, you can use the Send HTTP Request to SharePoint action in Power Automate to call the Versions REST API and restore the previous version.

  • Start by using the Send HTTP Request to SharePoint action to call /_api/Web/Lists/getbytitle('NameOfTriggeredLibrary')/items(IdOfTriggeredItem)/Versions
  • Use an expression to grab the "next to last" version returned from the Versions call. Depedning on what you named the previous action, it would look something like first(skip(Send_HTTP_Request_to_Get_Versions('value'),sub(length(Send_HTTP_Request_to_Get_Versions('value')),2)))
  • Execute RestoreByLabel by using another Send HTTP Request to SharePoint action to call /_api/Web/Lists/getbytitle('NameOfTriggeredLibrary')/items(IdOfTriggeredItem)/Versions/restoreByLabel('LabelOfPreviousVersionHere')

You may even want to encapsulate all of that in a separate Flow that you can then execute from other Flows as necessary by passing in the Library Title and Item ID.

3
  • hope u r doing fine in this crisis. can you please elaborate on step 2: what kind of components shall I use? I am using condition with length(first(skip(Send_HTTP_Request_to_Get_Versions_2('value'), sub(length(Send_HTTP_Request_to_Get_Versions_2('value')), 2)))) but it fails as I need to check that if there is a previous version. The second question, what happen if there are multiple rejection versions there? I guess we need to parse the response and find the most recent approved version and then restore it? Is there a quick way for fixing this? Commented Mar 24, 2020 at 23:00
  • try first(skip(Send_HTTP_Request_to_Get_Versions_2('value'),sub(length(Send_HTTP_Request_to_Get_Versions_2('value')),2)))
    – willman
    Commented Mar 25, 2020 at 0:44
  • 1
    hmm, yeah, multiple rejected versions would be a problem -- instead of just grabbing the next-to-last, you would want to set an array variable equal to reverse(Send_HTTP_Request_to_Get_Versions_2('value')), then use and apply to each loop to iterate through the versions and stop and the first one with a status of Approved.
    – willman
    Commented Mar 25, 2020 at 0:46
0

Technically once you commit the changes in SharePoint we can't rollback it directly but through some work around we can do it.

Create another as example temp column, update this with the original column value through the workflow, so here original column value will be retained.. now when approver reject the request update the original column value through this temp column value.

All these can be done using the workflow or flow - this way we can rollback the column value.

1
  • I see , thx , or maybe, create a backup list, but it is unfortunate that SP does not come as a template or a setting Commented Mar 21, 2020 at 5:53
0

I found that if I right click on a modified item, then click on the version history, then click on one of the modified dates, then I get the restore version option. I assume this only works when we have at lease one approval in place. I mean if the first insert is rejected, then this restore version does not work. Well it acutely should not, because there was not any previous version and deleting this new item literally takes us to the previous version of the list.

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.