Cancel your pending approvals in Microsoft Flow

There are quite a few posts about approvals in Microsoft Flow. Have you ever noticed that when you have one of your flows sending an approval that there is no option to cancel the approval step?

No cancel option

In this post I’m describing one approach fro cancelling the approval steps so that you can resubmit the approval step.

Also, so far there isn’t an cancel approval step available yet in Flow.  Hopefully it will arrive soon. So that I can avoid this pattern.

The Pattern

I’m going to start with the general pattern of the approval step and the cancellation of the same approval.

In my case the approval is initiated from a PowerApp. With the Create an approval I’m creating an approval.

This will create an entry within my common data services that presents the approval step to the user that needs to approve the action.

Then within my left branch I’m going to sit and wait for a response.

In the right branch I’m checking the current details of my approval task.

Get approval details

Once I get the details I set a variable to collect the current approval status. While waiting for a user to respond this will be set to Pending.

A Do until in the right branch will no check on a regular basis the status of my request again and again.

Now finally if the request was cancelled I need to terminate the flow that is running.

The terminate step in the above screenshot I’ve set to complete successfully. That way my flows will not fail.

Also note that the approval status is spelled Canceled rather than Cancelled.

Cancelling the request

To update the approval request in my Common Data Services, I’m creating a flow that takes an approval Id and then updated the Record in my CDS and marks it as cancelled.

In my case I’m using a flow to do this using the approval id from the request.

 

 

Advertisements

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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