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
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?
For some reason the API call returns 0 results. Please advise.
This really helped me out man. Thank you.
Still works? Cause I’m getting errors… and i need this so much, please
I get only personal productivity flows data that too the trigger is sharepoint related. If I create scheduled or instant flows that data is not coming up. any idea how to get the environment name and associated flows
Thanks in advance!
None of my sites seem to have a list called MasterSiteInventory. If I google “SharePoint MasterSiteInventory” the only search result is this post. Doesn’t seem like it’s a list that is documented anywhere.