Save Running FLOW Instance URL In Your Record

Problem

Considering SharePoint on-premises 2013 version as example, we were able to locate the workflow logs, tasks, and history for a specific list item or document easily. Just select the item -> go to workflow settings and you are there.

But with SharePoint online, now all of us are using Power Automate as workflow engine. As you know Power Automate is not meant only for SharePoint, you can automate processes of hundreds of different data sources. You won’t be able to find any references or association in SharePoint interface for the FLOW which is running for your list or library. Of course, you can go to FLOW run history, and find the instance by matching up created or modified time – but that’s a tedious job and if you have thousands of records and instances running then it’s a very difficult job.

So how can you find the URL of the running flow instance for a specific item or file easily?

Solution

Well, we can actually generate and store that instance URL in the record itself. Follow up with me to see how you configure it.

Navigate to FLOW portal -> locate your FLOW which you have created for your list or documents library -> Edit the FLOW -> Add a compose action to understand function and its output -> it’s a workflow() function as shown below

This is the output/response of workflow function

Workflow() function - this will give us the information we need to generate the URL. It returns environment ID, FLOW ID, and running instance ID as well. We just have to contact these things in a specific format as shown below

Format

https://asia.flow.microsoft.com/manage/environments/{environmentID}/flows/{flowID}/runs/{runID}

Example

https://asia.flow.microsoft.com/manage/environments/Default-def3cd14-db5d-404b-b4b5-ef1169bd8df5/flows/ec4c0f20-1bed-411b-8425-1a8bf242beba/runs/08585600481557728742677183949CU28

Use contact function as shown below to generate the instance URL, you can access the node values of above output using below syntax

  • Environment name – workflow().tags.environmentName
  • FLOW ID – workflow().name
  • Run ID – workflow().run.name

Putting it all together with concat function – it should look like below. Put this in compose action or assign it to a variable which we will use in next steps.

concat('https://asia.flow.microsoft.com/manage/environments/', workflow().tags.environmentName, '/flows/', workflow().name, '/runs/', workflow().run.name)

Now that we have the URL generated, we must store it in the current record. Add Hyperlink column in your list or library as shown below. Also, add RunFLOW yes/no column, this is needed to avoid self-trigger of the FLOW. Set Yes as default value in RunFLOW column.

Back to the FLOW, Use Update item action -> Save above generated URL in hyperlink column. And set RunFLOW to No. Whenever FLOW runs for a record, it will update back the same record with the URL of running FLOW instance.

Check below screenshot to see how the instance URLs are stored in the record itself. So, whenever there is any issue with the FLOW, with record and if end users come to you/admin asking to rectify the issue -> you can directly click on the link and open the running instance and troubleshoot.

Save running FLOW Instance URL in your record

Now the last and most important part in this configuration is “How to avoid self-triggering of the FLOW?”. Because we are updating the same item on which the FLOW was triggered. I have explained that in a separate article, do check out it from here.

Also, do check out this configuration in action on a youtube video from here.

Summary

So, we have made an association between SharePoint online interface and Power Automate FLOWs. Now you can just go to your list or library, look for the record and click on the link to open the running instance of the FLOW. Isn’t it easy now? Do share your thoughts and queries in the comment box below. Thank you for reading.


Similar Articles