Skip to content

Power Automate

Cancel An Approval In Power Automate

Cancel An Approval In Power Automate Posted by - Matthew Devaney on - June 2, 2024 56 Comments You can cancel an approval in Power Automate by using a single...

Matthew Devaney
Published
Reading time
3 min read

Before you start

Is this guide for you?

Best entry point
Power Automate
Time investment
3 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/cancel-an-approval-in-power-automate/. Author: Matthew Devaney.

Cancel An Approval In Power Automate Posted by - Matthew Devaney on - June 2, 2024 56 Comments

You can cancel an approval in Power Automate by using a single flow action. This ability is not included in the standard approvals actions. However, we can invoke an HTTP request to call the Microsoft Teams approvals API and cancel the request. Table of Contents

Introduction: The Cancel An Approval Flow Choose An Approval To Be Cancelled

Get The Approval Id For The Approval To Be Cancelled

Make A Connection To Microsoft Teams Approvals

Cancel An Approval In Power Automate Using An HTTP Request

Run The Cancel An Approval Flow In Power Automate

Introduction: The Cancel An Approval Flow

An employee at a financial services firm makes a travel request to their manager using Microsoft Teams approvals and then leaves the company. We will cancel the approval by creating a Power Automate flow. Choose An Approval To Be Cancelled

An approval may only be cancelled when it is in requested status. Open Microsoft Teams approvals center and find a “requested” approval.

Or create a new approval request if there are no approvals with a requested status. Here’s an example that can be copied if needed.

Get The Approval Id For The Approval To Be Cancelled

To cancel an approval using Power Automate we will need to get the Approval’s unique ID. Go to make.powerautomate.com and navigate the Approvals table (in Dataverse). Search the table for the record with a matching Title. The unique identifier is located in the Approval field of the record.

Set The Approval ID And Flow Environment Variables

Now we have the information needed to make our Power Automate flow. Start a new instant flow and add an initialize variable step. Create a variable named varApprovalId and set the value to the unique identifier of the approval.

Then initialize another variable named varFlowEnvironment and set the value to the unique identifier of the current environment.

The unique identifier for the current environment can be obtained by using the following expression.

workflow ()? [ 'tags' ] ? [ 'environmentName' ] Code language: CSS ( css )

Make A Connection To Microsoft Teams Approvals

An approval cannot be cancelled using the standard Microsoft Teams actions included in Power Automate. We will use the HTTP With Microsoft Entra ID (Pre-authorized) – Invoke An HTTP Request action to cancel an approval instead.

Upon adding the action we will be asked to setup a connection.

Use the following URL in both the Base Resource URL and Microsoft Entra ID Resource URI fields and press the Sign In button. https: //approvals.teams.microsoft.com Code language: JavaScript ( javascript )

Cancel An Approval In Power Automate Using An HTTP Request

Fill-in the flow action with the following values to cancel the approval request. Method: DELETE Url of the request:

https: //approvals.teams.microsoft.com/api/cancelApproval/@{variables('varApprovalId')}?flowEnvironment=@{variables('varFlowEnvironment')} Code language: JavaScript ( javascript ) Headers: Key Value Accept application/json

Run The Cancel An Approval Flow In Power Automate

That’s all it takes to cancel an approval using Power Automate. Save the flow and give it a test run.

After the flow is completed we can see the approval has been cancelled in the Teams Approvals Center.

And the cancellation, who performed and the timestamp are reflected in the approval details. Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about Cancel An Approval Flow In Power Automate please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate

Save Docusign Document To SharePoint With Power Automate

Share this

Tagged

Approvals · Power Automate

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →