Power Automate: Save Run Flow URL to SharePoint List Item
Power Automate: Save Run Flow URL to SharePoint List Item
When running a Power Automate flow, capturing and saving the flow’s run URL to a SharePoint list item can simplify troubleshooting and auditing. This allows you to easily revisit the flow run details in case of failures or for review purposes. However, note that flow run URLs are only available for 30 days, so older links may no longer work.
Capturing and Saving the Flow URL
The current flow URL can be captured and saved to a variable using the following format:
https://flow.microsoft.com/manage/environments/workflow().tags.environmentName/flows/workflow().name/runs/workflow().run.name
Steps to Save the Workflow URL
- Capture the Flow URL: Use the following format to dynamically generate the flow URL during the flow execution:
https://flow.microsoft.com/manage/environments/workflow().tags.environmentName/flows/workflow().name/runs/workflow().run.name
- Save to SharePoint List Item::Add an action in your flow to update the SharePoint list item with the generated URL.
Enhancing the View with Column Formatting
To improve the user experience, you can apply column formatting to the SharePoint list column where the flow URL is saved. This formatting will display the URL as a clickable link with custom text.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "=if(@currentField!='','View processing details','')",
"attributes": {
"target": "_blank",
"href": "@currentField"
}
}
Result of Column Formatting
After applying the formatting, the column will display a clickable link labeled “View processing details” if a URL is present.