Detailed Actions in the Flow:
-
Fetch Flow Run Data:
- Use the Power Automate Management connector or Flow API to list flows and their current statuses (running, succeeded, queued, etc.).
-
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).
-
Identify Relevant Flows:
- Create conditions to identify flows exceeding the threshold. Tag them as “To Be Canceled” for further processing.
-
Cancel Flows:
- Use the "Cancel Flow Run" action or API endpoint to terminate flows flagged as exceeding the time limits.
-
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.
- Notify stakeholders via Teams about the canceled flows. Include details such as: