Cancel approval workflows in Power Automate

Have you or one of your colleagues ever started an approval workflow using Power Automate and then needed to cancel it? Perhaps you put in the wrong approvers, too few approvers, too many approvers or you sent the file off for approval and realized it needed a few more edits before final approval. It happens and it happens often.

This is a scenario that seems to be ignored in general, but deserves some attention.

Why a cancel scenario is usually needed

Canceling an Approval does not cancel the workflow the Approval is running in, so if you don't handle those cancel scenarios your workflow will breakdown or error out. A cancel action might result in an Approved or Rejected result depending on the way you build your workflows, which will then run through the rest of your workflow incorrectly. You may also have the workflow completely error out on you, which will leave any other updates and changes in a perpetual half-finished state.

The good news is: workflows in Power Automate are quite flexible and can handle all types of situations and scenarios...if you build it!

Starting with only Approve/Reject options

In Power Automate I almost always see approvals designed with only two results: Approve or Reject. Once an approval action is added, generally a conditional statement is added next to check the result chosen by the approver(s). This could be configured to check against an Approve value or a Reject value and will send it down the Yes or No path depending on how you've configured it and the result of the approval.

A Power Automate flow with Yes and No paths

In the above example, there is a check to see if the Outcome is equal to Approve. If that evaluates to True (i.e. Outcome = Approve) then we venture down the Yes branch of the condition to complete the rest of the workflow. This could include updating SharePoint metadata, sending emails to alert people, starting another workflow, or any number of things to complete your approval process.

If the statement evaluates to False however, then we travel down the No branch of the condition. The assumption usually is: if it wasn't Approved then it must be Rejected! But that's not actually true... the value could be Reject or "blank."  The blank condition happens when an Approval is cancelled by the Requesting user, and it returns a null or empty value.

Now you probably have additional actions to indicate the item was rejected through SharePoint metadata, emails, or other actions in your workflow that occur after a rejection. All good if it was rejected, but when it's cancelled, we don't want this to happen!

On top of that if you wrote your logic the other way to check if the value was Reject, then cancelled workflows would actually travel down the Approve path! Now you're in some trouble as items are updated and emails are sent alerting people of an approved item that never was approved. Uh-oh! This could be a serious problem in a high-profile solution that touches senior leaders in the organization.

How do we handle those situations in our workflows where a user cancels?

Well, you could add a second, nested condition in your No path that then checks if the value is actually Reject (in our scenario, it could be Approve in yours). The second condition then handles the situation in the Yes path for Rejected approvals and puts in additional logic in the No path for the Cancelled scenario — perhaps changing the metadata to Cancelled or back to Draft and then Terminating the workflow. This diagram illustrates this example scenario:

Power Automate flow with nested condition under the No path

This does work, but it's a bit ugly and cumbersome to manage. Instead, I like to build my approvals with a Switch case, which will compare the Outcome to 3 potential results:

  • Approve

  • Reject

  • Default

The Default case will catch the blank value that our cancelled approval returns as an outcome. I find this is a much cleaner looking workflow that is easy to follow when troubleshooting issues or making updates, as shown below:

Power Automate flow with a Switch case

Recommendation

The Switch case is very clear cut when you look at the workflow and allows you to easily understand the outcome and result. At the end of the workflow, we've handled the two common options of Approve and Reject but we've also caught Cancelled approvals and can handle them appropriately. This might include cancelling the workflow as I've shown here, but it could also be changing the appropriate items and continuing along in your workflow depending on the process from here.

TIP: Set variables in your Switch cases to capture comments or statuses and then do your standard updates using those variables once outside of the Switch cases, rather than in each branch of your approval where applicable. Fewer action = less maintenance for updates. It's much easier to update a single action with variable results instead of updating 3 actions in each switch case that does the same thing but with a different value.


Need help with Power Automate workflows? We have expert Microsoft 365 developers who can help.

Jeff Dunbar

Jeff is a technical expert in the design and configuration of SharePoint, Microsoft/Office 365 and Collabware. Jeff has created and maintained sites, site collections, and applications for SharePoint for small to large scale environments. He assists companies in managing their compliance using third-party add-ons and out-of-the-box records management. Jeff has planned and implemented information architecture, content management, content design, usability studies, and site re-designs.

Previous
Previous

How to setup a contract management solution with SharePoint Syntex

Next
Next

Why you should always govern SharePoint content types