Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

How to cancel running Power Automate flow when a file was modified

Posted on July 13, 2022July 17, 2022 by Tom

“I’d like to restart the approval process when somebody modified the file in SharePoint, how can I cancel the running Power Automate flow to start a new one?”


If you use Power Automate to build approval processes, you want to make sure that everyone approves the same file in the same version. You could hardly call it a reliable solution if somebody changes the file in the middle of the process.

The best solution would be to remove all edit permissions right after you start the approval, but if you decide not to do that, you might at least cancel the running approval process. And this article will show you how to do that.

Keep the running flow id

The flows in Power Automate don’t know about each other. It can easily run 10 processes on the same document and be fine with that. Therefore, if you want to know about a running flow, you must keep the information yourself.

If you’re working with SharePoint document library, you can add one extra column, e.g. RunningFlowID.

Alternatively you could use also a separate SharePoint list to keep the information.

In both situations you want to store the flow run id in the column using an expression.

workflow()?['run']['name']
Power Automate cancel flow modified

Cancel the running flow

Once you have the id you can easily see if there’s already a running flow. If the column has a value, there’s already a running flow to cancel.

Power Automate has a dedicated action that’ll do that – in the ‘Power Automate Management’ group ‘Cancel Flow Run’.

The action has 3 inputs: the environment, flow, and run id. The environment and flow will be fixed, while the run id is the id you stored in the previous step.

You just cancelled the running flow and you can continue with the next steps in the flow. Just make sure to run the flow only if there’s an update by the user and avoid the infinite trigger loop!

Power Automate cancel flow modified

Summary

You can cancel a Power Automate flow when an item or document is modified and run a new one, but you must keep the flow run id somewhere. Once you have the current flow id Power Automate will let you cancel that flow at the beginning of the new instance. Reset the status, empty the approval history and start from the beginning.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes