Store link to executed Flow in SharePoint

What if you had a SharePoint list and you trigger a Microsoft Flow when an item is created in the list.
This might happen hundreds or thousands of times a day/week.
But how do you find out if the Flow did what it had to when it ran on the item? You go to flow.microsoft.com of course. Then you find out which Flow it was by looking through the list of crypticly named Flows you have access to. Finally you find it and you start browsing through all the Flow executions. You open them one by one until you find the Flow execution that handles the specific newly created item you are interested in.

This is not a very user friendly way of integrating MS Flow in SharePoint you might say! Wouldn't you want a link to the Flow execution log right from the SharePoint item that triggered the Flow? (hint: yes, you want this).

With this MS Flow expression you can get a URL to the executed Flow:

concat('https://emea.flow.microsoft.com/manage/environments/Default-0e0c2c6b-835a-4d45-8a92-4fac0d3be692/flows/', workflow().name, '/runs/', workflow().run.name)

The first part is the URL to your MS Flow tenant, so this is different for you. You need to specifiy your own values for both the region (in this case EMEA) and the Default-GUID, but you can easily get this from the browser address bar when you are inside MS Flow. The workflow() expression holds some metadata of the currently running workflow, and it turns out workflow().name is the guid of the Flow, while workflow().run.name is the ID that identifies a single execution of the flow. See the Logic App Workflow Definition Language for more info.

If you create a SharePoint list, and then create a Flow triggered on item creation in that list, then you can use this expression to save back the link to the executed Flow to the SharePoint list item.
In this way you can go to the exact executed Flow from the SharePoint list item itself.
Flow link 1 The Flow that is triggered by creating an item in SharePoint. It can then do a bunch of stuff but in the end you want to store a link to the executed Flow back to the list item.
Flow link 2 The Flow has run and the link is stored, in this case in the title field.
Flow link 3 When you follow the link you end up in MS Flow on the executed Flow that you're interested in.

Show Comments