DEV Community

Cover image for Monitor & Alert: Notify Admins When Scheduled Power Automate Flows Are Deactivated (Using FetchXML)
Nikhil Sarpatwari
Nikhil Sarpatwari

Posted on

Monitor & Alert: Notify Admins When Scheduled Power Automate Flows Are Deactivated (Using FetchXML)

In Power Platform, scheduled Power Automate flows often handle critical background processes like data syncs, report generation, and reminders.

If a flow is disabled for any reason, there is no built-in synchronous or hourly alert system in place, other than receiving an email about several flow failures. The flow stops running, which can lead to missed business-critical tasks.

This post explains how to build a monitoring flow that detects deactivated scheduled flows and notifies administrators via Microsoft Teams. It uses FetchXML on the Dataverse workflows table and requires no premium connectors.

What This Flow Does

This Power Automate flow:

  • Detects deactivated flows with a recurrence (schedule) trigger
  • Runs daily on a schedule
  • Queries the workflows Dataverse table using FetchXML
  • Sends a Microsoft Teams message to admins with flow details

Why It’s Needed

  • No built-in mechanism alerts administrators when a flow is turned off
  • Business stakeholders often discover failures only after the impact is felt

This solution provides proactive governance to prevent such issues.

Understanding the workflows Table

All Power Automate flows and classic workflows are stored in the workflows table in Dataverse. The key is to filter for scheduled flows that are deactivated.

Filter criteria:

Field Purpose
category = 5 Identifies modern Power Automate flows
type = 1 Indicates a definition (not an instance)
statecode = 2 Flow is deactivated

FetchXML Query

<fetch> <entity name="workflow"> <attribute name="name" /> <attribute name="ownerid" /> <attribute name="modifiedon" /> <attribute name="statecode" /> <filter> <condition attribute="category" operator="eq" value="5" /> <condition attribute="type" operator="eq" value="1" /> <condition attribute="statecode" operator="eq" value="2" /> </filter> </entity> </fetch> 
Enter fullscreen mode Exit fullscreen mode

Steps to Build the Flow

Step 1: Trigger the Flow

Use a Recurrence trigger to run the monitoring flow daily/hourly/custom.

Step 2: Query the workflows Table

Add the List rows action from the Dataverse connector.

  • Table name: workflows
  • Fetch Xml Query: Paste the FetchXML query shown above

Step 3: Loop and Format Flow Details

Use an Apply to each action to loop over the query results.

Inside the loop, create a message with:

  • Flow name
  • Owner
  • Modified date

Example message:

Deactivated Flow(s) Detected Flow: Daily Sync Owner: alex@company.com Last Modified: 6 July 2025 
Enter fullscreen mode Exit fullscreen mode

Step 4: Post Message to Microsoft Teams

Use the Post message in a chat or channel action from the Microsoft Teams connector.

Configuration:

  • Post as: Flow bot
  • Post in: Channel
  • Team: Power Platform Admins
  • Channel: Flow Monitoring
  • Message: The message created in the previous step

Example Output in Teams

Deactivated Scheduled Flow Detected Flow: Weekly Sales Digest Owner: alice@company.com Last Modified: 2025-07-05 Please review and reactivate if necessary. 
Enter fullscreen mode Exit fullscreen mode

Tip

You can create a powerautomate flow in your sandbox environment and choose the target environment like a production environment and this way you can avoid this as part of your deployment package.

PowerAutomate Flow Image

Optional Enhancements

  • Store excluded flows (e.g., test flows) in a Dataverse table or Excel file
  • Filter for flows modified in the last 24–48 hours
  • Include a direct link to the flow: https://make.powerautomate.com/environments/<env-id>/flows/<flow-id>
  • Log alerts to a Dataverse table for auditing
  • Add an approval process for reactivation

Practical Example

A daily sales report flow is disabled for testing and forgotten. The monitoring flow runs the next morning, detects the deactivation, and alerts the admin channel in Teams. The flow is reactivated before any issues are noticed.

Summary

This Power Automate monitoring solution:

  • Uses no premium connectors
  • Relies on standard Dataverse features
  • Proactively detects silent failures
  • Enhances flow governance across environments -Use it production as well sandbox environments

Top comments (0)