Get Link To A Particular Flow Run

There can be various situations where you need to know the link to a particular Flow run, for example in case of a failure, or if you want to store the unique ID of each run against your data record for future audits or traceability.

In this post, we will learn:

  • How to get ID of the cloud Flow
  • How to get unique ID of a cloud Flow run
  • How to get link to a cloud run
The trick to get these details is the workflow() expression, which returns all details about the workflow during run time.

To add this into your Flow, simply use the expression: workflow()

A sample output of this expression is in below format:

{
    "id""/workflows/e54ef274a2f14b54af75fabc3c3c86d3",
    "name""8a854a53-5863-47d1-acc9-c5993d8f48ff",
    "type""Microsoft.Logic/workflows",
    "location""westeurope",
    "tags": {
        "flowDisplayName""FLOW-NAME",
        "environmentName""YOUR-ENVIRONMENT-ID",
        "logicAppName""8a854a53-5863-47d1-acc9-c5993d8f48ff",
        "environmentFlowSuspensionReason""REASON-ID"
    },
    "run": {
        "id""/workflows/e54ef274a2f14b54af75fabc3c3c86d3/runs/08585709922877760593772398976CU154",
        "name""08585709922877760593772398976CU154",
        "type""Microsoft.Logic/workflows/runs"
    }
}

Using above output, we can now get our desired values.

ID of Power Automate cloud Flow
workflow()?['name'] - this will be same each time the same Flow runs, and identifies your Flow.

Unique ID of a particular Flow Run
workflow()?['run']?['name'] - this will be different every time a Flow runs, and identifies your particular Flow run.

Link to a particular Flow Run
This will be different every time a Flow runs, and links to your particular Flow run. This will let you go directly into the Flow run and see the run details. To construct this, we will utilize the concat() function as below:

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


Comments

Popular posts from this blog

Generate QR code within Power Automate

Restrict Attachment control in PowerApps to accept Excel files only

Get start and last date of month using Power Apps