Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Cancel long flow runs

(1) ShareShare
ReportReport
Posted on by 115
The Power Automate flow aims to identify and cancel flows running or queued for excessive durations, improving system performance and avoiding task bottlenecks. However, the primary challenge has been that notifications in Microsoft Teams do not display the name of the flow or its run ID. The messages only indicate whether the flow was in a "running" or "queued" state, making it harder to trace specific flows.
 

Detailed Actions in the Flow:

  1. Fetch Flow Run Data:

    • Use the Power Automate Management connector or Flow API to list flows and their current statuses (running, succeeded, queued, etc.).
  2. Filter Long-Running or Queued Flows:

    • Compare each flow's runtime or queue duration with a predefined threshold (e.g., 1 hour for running flows, 30 minutes for queued flows).
  3. Identify Relevant Flows:

    • Create conditions to identify flows exceeding the threshold. Tag them as “To Be Canceled” for further processing.
  4. Cancel Flows:

    • Use the "Cancel Flow Run" action or API endpoint to terminate flows flagged as exceeding the time limits.
  5. Send Notifications to Microsoft Teams:

    • Notify stakeholders via Teams about the canceled flows. Include details such as:
      • Flow status (Running or Queued).
      • Additional data available from the API (e.g., timestamps, correlation IDs).

    Current Issue: Notifications in Teams fail to include the flow name or run ID, limiting traceability. This is a key pain point being addressed.

  • razec18 Profile Picture
    razec18 115 on at
    Cancel long flow runs
    Hi Mark!

    I'm using List Rows from a selected environment to do this.
     
     
    With this, I can discover with flows are running for more than X hours and on the queue for more then X hours.
  • Mark Nanneman Profile Picture
    Mark Nanneman 831 on at
    Cancel long flow runs
    How are you listing the flow runs to cancel them?  

    I'm not aware of a Power Automate Management action that lists flow runs in Power Automate, though you can do it by invoking an API request.

    The Power Automate Management "List Flows as Admin (v2)" will give you the display name of each flow,
    so if you can use it and then list and cancel the running flows under each one you should be able to append that to your array or whatever is returning the list of canceled flows you can include the flow name.

    It's under "properties/displayName"

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Kickstarter Events…

Register for Microsoft Kickstarter Events…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,858

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,505

Leaderboard