“Can I link SharePoint item directly to a specific flow run to easily find the right Power Automate flow instance? It takes so long to find the right flow in the run history.”
If you run a flow very often, e.g. for each update of each SharePoint item, you’ll have a lots of runs. And lots of runs mean a lots of entries in the flow run history. And the more entries you have, the harder it gets to find the right one.
When you search for a flow that did run on a specific item, you might end up checking 10+ flow runs until you find the right one. It’s bit of a step back from the old SharePoint workflows where you could add the link to the flow with a single checkbox. If you want such a link to Power Automate flow, you must add it by yourself.
Build the link to the flow
Opening any existing flow run history in a browser, you’ll see that it has always the same format. There’s the environment id, flow id and flow run id, and then the rest of the url. Therefore, if you knew the 3 ids, you could build the link to the flow run manually.
https://emea.flow.microsoft.com/manage/environments/<environmentID>/flows/<flowId>/runs/<runId>
For example:
https://emea.flow.microsoft.com/manage/environments/Default-c3adda97-1234-44f6-9fbb-ecf0395f334b/flows/2ef6c1be-1234-4c58-8c69-55783da7f30e/runs/08585722999521234205098139360CU227
Power Automate has an expression workflow() that will give you all the information about the running flow. Among the information are the 3 id’s required to build the url. All you need to do is to build the whole url string by combining the fixed parts and the workflow() parts.
Build the whole url with the concat(…) expression, and workflow() expression with a bit of JSON navigation.
concat('https://flow.microsoft.com/manage/environments/', workflow()?['tags']['environmentName'], '/flows/', workflow()?['name'], '/runs/', workflow()?['run']['name'])
Store the url in a column in the SharePoint item and you’ll get a direct link to the flow run. Just be careful about the potential infinite trigger loop.
Summary
It’s easy to get lost in the flow run history if your flows run very often. Power Automate by itself doesn’t offer any connection, any link between a SharePoint item and a flow run. Therefore, if you want a direct link in the item properties, you must build and update it by yourself.
And it’s not the only usage of the link as already shown in the instant error messages from your flows.
I tried your code above.
I selected the list item and clicked Automate and my workflow.
It stored the url in a field in the list item.
When I try the created url all it does is open the workflow history for the run that generated the URL.
I REALLY want this to work.
Hello Chris,
that’s what the flow does, stores the url to the flow that updated the link, that’s why the link should be set in the actual flow that’s doing the work.