How to find all associated Power Automate Flows for a SharePoint list?

Summary

A customer showed a working Power Automate for an item created trigger. There was an approval action in the flow so technically only one email should be sent for a new item. But she noticed multiple approvals emails were sent. This was no way possible.

Our suspicion was there may more than one flow associated to the list. What if, this flow was duplicated by someone and that also started running for an item created event.

The question is, how do we find out how many flows are associated to the list?

The answer is to make a call to the SyncFlowInstances to the list to find all associated Power Automate Flow.

Step By Step solution

Step #1 First, create a Manually Triggered Power Automate Flow.

Step #2 Add “Sent an HTTP request to SharePoint” action

Make a call to SyncFlowInstances

Copy paste values to your ” Sent an HTTP request to SharePoint” action. Make sure to change the list name below, my list name is MasterSiteInventory yours may be different.

Site Address: [Your Site]

Method: POST

Uri:

_api/web/lists/GetByTitle('MasterSiteInventory')/SyncFlowInstances

Headers:

{
  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"
}

Body: EMPTY

The above call returns a response in the FlowSynchronizationResult. The intent now will be to get the data from the FlowSynchronizationResult.SynchronizationData property. This property stores value as JSON string as seen in the below sample data.

{
  "d": {
    "__metadata": {
      "id": "https://BLAHBLAH.sharepoint.com/sites/siteprovisioning-preprod/_api/web/lists/GetByTitle('MasterSiteInventory')/SyncFlowInstances",
      "uri": "https://BLAHBLAH.sharepoint.com/sites/siteprovisioning-preprod/_api/web/lists/GetByTitle('MasterSiteInventory')/SyncFlowInstances",
      "type": "SP.FlowSynchronizationResult"
    },
    "SynchronizationData": "{\"value\":[{\"name\":\"1a7", REMOVED FOR BREVITY"
    "SynchronizationStatus": 0
  }
}

Step # 3 Now parse and convert the above SynchronizationData JSON string to HTML

Add a Compose action with the following formula. As you can see the data is converted first to JSON and then we access the value property. The value property is a JSON array.

json(outputs('Send_an_HTTP_request_to_SharePoint')?['body']?['d']?['SynchronizationData'])?['value']

Step # 4 Now iterate the value JSON array to select name and display name.

From

outputs(‘Compose’)

Map

{
  "ID": {@item()?['name']},
  "Name": {@item()?['properties']?['displayName']}
}

Step # 5 Now, just take the output of select and pass to Create HTML

Conclusion

Using the above method you can quickly find out how many flows are associated on your list.

Here was my output for the above flow.

My inspiration to write this blog is from the below article.

How to get a list of Flow instances attached to a SharePoint List?

About Pankaj

I am a Developer and my linked profile is https://www.linkedin.com/in/pankajsurti/
This entry was posted in Power Apps, Power Apps, Power Automate. Bookmark the permalink.

2 Responses to How to find all associated Power Automate Flows for a SharePoint list?

  1. Chaitra B C says:

    For some reason the API call returns 0 results. Please advise.

  2. Craig says:

    This really helped me out man. Thank you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s