Which flow run is related to my SharePoint list item or document

In one of my recent posts I mentioned the workflow function in Microsoft Flow. In this post I looked at which elements are needed to create the Url used by flow run.

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.

concat('https://unitedkingdom.flow.microsoft.com/manage/environments/',
outputs('Compose')['tags']['environmentName'],
'/flows/',
outputs('Compose')['name'],
'/runs/',
outputs('Compose')['run']['name'])

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.

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:

concat('https://unitedkingdom.flow.microsoft.com/manage/environments/',
workflow()?['tags']['environmentName'],
'/flows/',
workflow()?['name'],
'/runs/',
workflow()?['run']['name'])
Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

View Comments

  • 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?

  • 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'])

  • 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

  • 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'])

Recent Posts

Calculate the Sum for a SharePoint column in Power Automate

Last week Shane Young asked me about calculating the Sum for a SharePoint column in…

3 hours ago

Object must implement IConvertible in Power Apps

In Power Apps when you do a Patch to create a new item or to…

4 days ago

Get started with adaptive cards in Power Automate

Getting started with adaptive cards can be difficult. In this post i have written some…

1 week ago

Create PDF documents from data in Power Automate

In this post I will look at how to create PDF documents from data. Use…

2 weeks ago

Unnest nested arrays in Power Automate

We all know this problem, you have a nested array in Power Automate but how…

3 weeks ago

Advanced settings not loading in Power Platform

Yesterday one of my clients showed me an issues where the Advanced settings didn't load.…

4 weeks ago
%%footer%%