Thursday, August 8, 2019

Update to using Microsoft Flow for approval of site pages

In May of last year I wrote a post which showed how you could implement approval of modern pages in SharePoint using Flow. That post was written before the edit experience implemented the Submit for approval button.

image

While the built-in approval is nice, Flow approval provides easy to use actionable messages which makes approving that much easier – no need for the approver to visit the page library to actually approve the item.

In my previous post I added a step to check for the Pending status of the page before invoking a Flow approval action in order skip the Draft and Approved states which should be ignored for the Flow itself. This means Flow will trigger more than actually needed – but that was the way to go last year.

Seems the SharePoint triggers have now been updated to support trigger filters, which means the steps can be optimized a bit.

Click the ellipses (…) on the trigger and pick Settings.

image

In the trigger conditions settings add the following to trigger only for items which are awaiting approval.

@equals(triggerBody()['{ModerationStatus}'],'Pending')

image

In order to use the content approve action you still need to get the correct ETag, which means the Get file metadata action has to stay.

A simple auto-approve Flow would look like below.

image

Happy Flowing!