SharePoint Approvals – Back to SP2010

This article is part of a series of community requests – if you have a burning question, no matter how technical or not, I encourage you to Just Ask, one of the community are happy to oblige and write a blog post for you to answer your question. Questions in this series have been asked for by social followers, community members or event attendees who are looking for answers they have not yet already found online. 

Today’s question with multiple parts, was asked by Terence Rabe via LinkedIn and raises some important – to – know steps in Power Automate, as well as some questions about the ways of working in the new collaborative workspace.

Details of the request for this article are;  

Sharon Sumner [MVP] Thanks 👍 don’t mind replying here… it’s folks who want to replicate the old SP 2010 workflows in Content Approval libraries where  

a) check in to publish triggers the flow,  

b) you could choose who the approvers were and  

c) the workflow updated the approval column from Pending to Approved.  

Should be simple but I’ve never been able to do it 😔” 

So, let’s break this down.  

a) Check in to publish triggers the flow

Firstly, the Information architect in me needs to ask why in a world of online collaboration we are stuck to the check-in / check-out nightmare of old? This alone, is a feature set I lost no sleep over seeing disappear when we moved to collaborative editing. Now, I get that every use case is unique but before you start following the tips and methods here, please revisit the user requirements and think carefully about the burden and overhead of document management that forcing check-in and out brings – no judgement here but consider removing permissions to edit and then working collaboratively. You see collaboration and check-in are polar opposites and so you will lose a lot of features by staying tied to this control mechanism (I could do a whole blog post on this topic) so let’s refocus on meeting your requirements as asked and revisit this one another day #JustSaying 

Back on track – so how to trigger from a check-in – and we are assuming that every check in is a trigger for a publish here (you could add a condition to test if you want to publish with a yes/no step as well.)  

Step 1 – Lets set up the document Library – I created an “approval test demo” document library in my sales team site. I set the settings as below to turn on versioning as well as to enforce check-in / out. 

Step 2 – Lets create a Power Automate flow to be triggered when an item is checked in to this library. Jumping directly to Power Automate we will start a flow from a blank template and pick our own trigger. We need to choose the “When a file is Created or Modified (properties only)” trigger from the SharePoint selection and configure to point to our document library as shown below;  

This trigger then needs to be followed by an action to check if the file is checked in or not – as you can see this status is available from the initial trigger actions dynamic content;  

So – if an Item is Checked out then (checked out = true) we do nothing, if its false then we start to process an approval. Obviously you could turn this logic on its head – your choice 🙂

b) you could choose who the approvers were

Having triggered the flow, we now need to perform a bespoke approval process where we tell the action who the authorizer/s are. Now, as with SharePoint 2010, you could do this in all kinds of ways such as a look up list, logic based on the content type, etc. These techniques would usually result in a column in the document library (whether visible or not) being set to the value of the authorizers.  

To keep this to a blog article and not a white paper, let’s work from a column in the document library where you are naming the authorizer/s of the document using any pre-processing you desire. We need to add this as a person field and pick the correct person for this step to work – Important: Do NOT just use a text column with an email address in it – let the controls do the work and pass you a valid email address (at the same time future-proofing from a name or domain change by being dynamic.) 

I’ve added a person column called “Approver” (yes this would support multiple approvers but let’s stick to one here) 

Back in the flow lets add in the Approval – this is really easy now with the out of the box approvals actions, we’ll choose the “start an approval and wait for the response” action to make sure we get back the outcome – we are not using this to gather anything from the approval other than accept / reject.

These approval actions can support may approvers and types of approval – simply pick the one that fits your needs. Lets add this to our “no” branch and use a simple First to respond method.

Then, in the Assign To column, we need to add in the approver from the documents “approver” column. It is not always obvious that you can add dynamic content in this field as it defaults to adding text – jut click the “add dynamic content” link to bring up the menu and then from the trigger you can see that because we used the “person” filed type, we have all the users data including their email address. Pick this. 

c) the workflow updated the approval column from Pending to Approved.

So, this moves us onto the final piece of the puzzle. Now this one does need a small tweak that will not be obvious, stay with me. There is a SharePoint flow action to “set content approval status” and this is the ideal candidate. However, simply adding this to your flow will cause a “E-tag” failure. The document we picked up with the trigger has an “etag” property that we need to gather and use for this step – easily done once you know how.  

Step 1 – was this approved 

Before we get started in this section we need to add in the condition based on the outcome of the approval – this is a simple step as shown below;  

Step 2 – get the metadata values for the trigger document

Following the approval we need to grab the trigger documents metadata – do this as shown with the “get File Metadata” action. One IMPORTANT note: you need to reference the item with the “Identifier” from the trigger action – many wasted minutes here if you put in the wrong path / id values. 

This action allows us to set the E-Tag that is collated from the metadata action into the “set content approval status” action which is our next step

Step 3 – set content approval status

Finally, add the E-tag and other data to the last action as shown below – again IMPORTANT: use the ID from the trigger to set the Id field here to save any wasted time from using the wrong IDs. 

All together now…

All together now… 

And that’s a wrap – lets walk that through what happens from a users perspective. 

1 – Checked in document to start with 

2 – Edit in word and check it in

3 – Document library status changes to pending 

4 – Approver should have approval task (approver is set to administrator – me) – lets approve the changes 

5 – Changes approved – item should now show as approved 🙂

Well, that’s an end to end test and hopefully I’ve covered all the potential pitfalls and time drains.

If you have any follow up questions or requests to see other features, please let me know and I’ll add to this or create another article for you. I hope this helps those feeling that they cannot migrate to SharePoint Online because of process constraints 🙂

Thanks for listening – don’t forget to leave comments below or get in touch with me directly if you’d like to chat about the content posted here or anything to do with the Power Platform – I’m a Business Applications speaker and evangelist with a clear focus on delivering real business value from technology. I speak at least once a month so please find me at an event and #LetsGetCoffee

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.