List modification approval

Copper Contributor

Hello, 
I have a leave request list in sharpoint and I have been able to create a good approval flow for when an item is created. However I would like to create an approval process for when an item is modified. 

what I can do is 

When an Item is modified starts approval process

if yes then nothing happens the modification stays the same 

 

What I am having serious trouble with is how I can delet the modifications that were made if the approval process is rejected. I have not been able to find anyone on the internet that has an example of how this can be done. 

 

Cheers

Sam

5 Replies

@EKIT415 As an owner of list you are able to change the visibility of columns for users. This means you are able to store old values when a user changes the list, meaning only the columns you design to be visible. 

 

Let's have a simple example:

List A have a Title column and OldTitle column. OldTitle is not visible to the user.

Creation flow: If created approved then OldTitle = null.

 

Change flow is an automatic flow when item is created or changed.

- first check: is OldTitle null, if yes then cancel flow because the change flow was triggered by creation flow, if no continue

- second check: if OldTitle = Title then cancel flow to prevent recursion.

- thirdly: set approval, if yes then OldTitle = Title. If no Title = OldTitle 

 

If you give me more context I make the flow for you. It also depends a bit on your use case

 

 

@Roy_Drissen 

Hi Roy,

I'm not sure how I would make the 'Old column'. also does that mean I would have to make a separate flow for every single column in the list?

 

EKIT415_0-1638148729342.png

This is the form that I have. When an item is created it starts a leave request process. then I have an issue that I want to create an approval process if this form is edited. 
So using when item is modified - start approval process - if approved then keep the edits - if declines remove the edits. 

I'm not sure if that is the kind of context that you wanted. Cheers

Sam 

@EKIT415 

Hi again, thanks for your reply and information.

It was actually an nice case and made me reconsider some of my own flow designs. I will put this case in a vlog which am preparing.

 

Some assumptions:

  • A user must be able to create an item without approval
  • A user must get an approval when he/she changes an item
  • You as a list owner must be able to roll back to the previous values of an item

Initial testlist

Roy_Drissen_0-1638619514642.png

  • Test user Athena and member of site (and therefore edit access to list)
  • Me as owner (user Roy Drissen) having full control
  • The list has a hidden column 'Approved' which is a boolean
  • When owner modifies approval is not necessary 

 

Let's start

I will let you take part in my thinking process.

The solution with an old value column only really works when only 1 or 2 columns are in the scope of change. So forget about that one. So I though, let's use version history. Given above assumptions I started to make some 'code' for an automatic flow.

 

Roy_Drissen_1-1638620082118.png

 

You can get the major version using

 int(first(split(triggerOutputs()?['body/{VersionNumber}'],'.')))

Then I ran into several checks which are required to meet the conditions (red: assumptions mentioned above)

Roy_Drissen_2-1638620506129.png

Additionally

Roy_Drissen_3-1638621046325.png

 

Then I started to think : this wil become very complicated and probably need to make a locking mechanism to prevent other users to change the item involved. I am actually doing things which SharePoint can do for us. So I looked in the  settings and check out the next settings:

 

Roy_Drissen_4-1638621492182.png

This comes close to the functionality you want, without programming anything at all. Users need to be familiar with versioning or you as an owner must restore the version. Additionally you can control who is able to see draft versions.

 

I hope this is any help.

 

Alternatively, if you want to resolve this in Power Automate you need to work with a duplicate list.

One list you allow users to make changes via an instant flow (list is read only)

Second list to keep track of changes by using the instant to copy draft items. 

This will require some special permissions and will become a bit more complicated.

 

Any reflexions on this?

 

Roy

 

 

 

 

 

 

 

 

 

 

 

@Roy_Drissen 

I have found a bit of a more elegant solution to this. 
It is a little bit fiddley and need adjusting depending what is in your list but 

 

here it is 

EKIT415_0-1638749935854.png

EKIT415_1-1638749961232.png

with a trigger control on the when item is modified

EKIT415_2-1638749994876.png

EKIT415_3-1638750047171.png

EKIT415_4-1638750078338.png

EKIT415_5-1638750098065.png

EKIT415_6-1638750127929.png

EKIT415_7-1638750149192.png

getting it to work with a lookup column with multiple selections was a little bit difficult. 
but I am now trying to get it to work with a multiple selection choice column and am finding it very difficult... 

 

_api/web/lists/getbytitle('Time Sheet')/items(@{triggerOutputs()?['body/ID']})/versions(

mul(sub(int(outputs('Compose')),1),512) is for the HTTP column 

 

 

 

 

 

I agree, more elegant but more complicated. I guess you need use Power Apps to change the SharePoint form and maybe use Filter(Choices(Powerappform. )
I had to come back on this. Nice case!