In one of my recent posts I mentioned the workflow function in Power Automate. In this post I looked at which elements are needed to create the flow run URL used by your flow.
A flow generating its flow run URL
With my two Compose actions I’m first collecting the flow details with the workflow function:
workflow()
Then my second compose action will build up the Url using the concat function collecting output from the details supplied by the first Compose action.
With this all in place I can now get the workflow history run of my flow. This I can now email to myself when something goes wrong making it very easy to identify the failed flows.
Which flow run is related to my SharePoint list item or document 1
if you prefer not to use the Compose actions you can of course also simply include the following in an email set out to a user:
Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like.
I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide.
For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions.
SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/
Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/
You can contact me using contact@sharepains.com
Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like.
I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide.
For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions.
SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/
Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/
You can contact me using contact@sharepains.com
18 thoughts on “Which flow run is related to my SharePoint list item or document”
I appreciate your time to blog this article. And this is a good tip when we are talking about these flows as they are not connected to the list items/documents like earlier SharePoint workflows. In a big organization where multiple instances of flows are running there is no easy way to track the specific flow instance. Its a hell. Thanks for showing a solution which is at least giving option to find that specific culprit flow ran.
In general I avoid variables when I can. You will find that when you use variables loops and concurrent branches will lock on the variable usage. Compose actions don’t have these locks.
I can imagine creating a “workflow history” list (like in the good old SPD WF 2010 days) with this info. Is it possible to grab the status with this method, so I cannot just log the link to the history, but also the outcome of it?
There are a couple of ’ (end quote) characters that need to be ‘ (single quote) characters. They are after the first two instances of the word “Compose” in this section:
I’m using this approach now, to log failed flows together with a document number, so I don’t need to lookup the time when the flow ran to find the right failed flow.
But I guess even with this direct link to the failed flow run, there still is no way (yet) to programmatically restart/resubmit one or more failed flow runs?
It worked like a charm in quite specific use case. Note to anyone use it later, change the the “unitedkingdom” part of the url to your country. I.e. “australia”. It seems to redirect to correct url even you put other country nonetheless.
Sorry, I made a minor mistake in my previous comment:
concat(‘https://emea.flow.microsoft.com/manage/environments/’,
outputs(‘Compose’)[‘tags’][‘environmentName’],
‘/flows/shared/’, // shared only necessary if flow is shared
outputs(‘Compose’)[‘tags’][‘logicAppName’], // replaced [‘name’] with [‘tags’][‘logicAppName’]
‘/runs/’,
outputs(‘Compose’)[‘run’][‘name’])
Thank you for this helpful article (especially part 1).
Your approach inspired me to use the following approach:
Add “Parse JSON” action
In the field “Content” use expression: workflow()
Click “Generate from sample” and use output from workflow() to generate a schema.
Then all the fields inside the workflow()-JSON is now available as dynamic content when creating a link in an email message.
I appreciate your time to blog this article. And this is a good tip when we are talking about these flows as they are not connected to the list items/documents like earlier SharePoint workflows. In a big organization where multiple instances of flows are running there is no easy way to track the specific flow instance. Its a hell. Thanks for showing a solution which is at least giving option to find that specific culprit flow ran.
Thank you for your comment. I am glad that my post has helped you.
Great solution. Quick question, why not use a variable instead of the second Compose action?
In general I avoid variables when I can. You will find that when you use variables loops and concurrent branches will lock on the variable usage. Compose actions don’t have these locks.
I can imagine creating a “workflow history” list (like in the good old SPD WF 2010 days) with this info. Is it possible to grab the status with this method, so I cannot just log the link to the history, but also the outcome of it?
If you use the try catch method
https://sharepains.com/2018/02/07/power-automate-try-catch-finally-flow/
Then update the status in the start of the try to running.
In the catch to failed
Atvthe end of the try to succeeded
Then that should work
Great stuff, thanks!
There are a couple of ’ (end quote) characters that need to be ‘ (single quote) characters. They are after the first two instances of the word “Compose” in this section:
concat(‘https://unitedkingdom.flow.microsoft.com/manage/environments/’,
outputs(‘Compose’)[‘tags’][‘environmentName’],
‘/flows/’,
outputs(‘Compose’)[‘name’],
‘/runs/’,
outputs(‘Compose’)[‘run’][‘name’])
Thanks Thomas. I fixed those in the post now.
Excellent article Pieter,
I’m using this approach now, to log failed flows together with a document number, so I don’t need to lookup the time when the flow ran to find the right failed flow.
But I guess even with this direct link to the failed flow run, there still is no way (yet) to programmatically restart/resubmit one or more failed flow runs?
Michel
Hi Michel
Thanks!
Have you tried John Liu’s Flow Studio? It will help with bulk restarting flows.
Thanks Pieter for the article.
It worked like a charm in quite specific use case. Note to anyone use it later, change the the “unitedkingdom” part of the url to your country. I.e. “australia”. It seems to redirect to correct url even you put other country nonetheless.
Thanks again.
Woong
Hi Woong,
Yes indeed, the urls all redirect. So it doesn’t really matter.
I was looking for this solution for such a looong time.
@Pieter Veenstra:
The JSON syntax needs to be slightly modified. The
concat(‘https://unitedkingdom.flow.microsoft.com/manage/environments/’,
outputs(‘Compose’)[‘tags’][‘environmentName’],
‘/flows/’,
outputs(‘Compose’)[‘logicAppName’], // replaced [‘name’] with [‘logicAppName’]
‘/runs/’,
outputs(‘Compose’)[‘run’][‘name’])
Because my flow is a shared Power Automate flow, I needed to modify the
concat(‘https://emea.flow.microsoft.com/manage/environments/’,
outputs(‘Compose’)[‘tags’][‘environmentName’],
‘/flows/shared/’, // replaced ‘/flows/’ with ‘/flows/shared/’
outputs(‘Compose’)[‘logicAppName’],
‘/runs/’,
outputs(‘Compose’)[‘run’][‘name’])
Sorry, I made a minor mistake in my previous comment:
concat(‘https://emea.flow.microsoft.com/manage/environments/’,
outputs(‘Compose’)[‘tags’][‘environmentName’],
‘/flows/shared/’, // shared only necessary if flow is shared
outputs(‘Compose’)[‘tags’][‘logicAppName’], // replaced [‘name’] with [‘tags’][‘logicAppName’]
‘/runs/’,
outputs(‘Compose’)[‘run’][‘name’])
Thank you for this helpful article (especially part 1).
Your approach inspired me to use the following approach:
Add “Parse JSON” action
In the field “Content” use expression: workflow()
Click “Generate from sample” and use output from workflow() to generate a schema.
Then all the fields inside the workflow()-JSON is now available as dynamic content when creating a link in an email message.
The Parse json action can indeed be helpful to simplify things a little bit.
Thank you for such a useful article. A quick question. How to ensure if the flow status (running or completed) before cancelling it.
Please have a look through the following post. This post uses the APIs to get the to flow runs.
https://sharepains.com/2023/03/09/high-volumes-flows-power-automate/
Using the API you can get the status of each flow run as well.