Saturday, November 20, 2021

Get Workflow Run in Power Automate

Fetching Current PowerAutomate run URL in PowerAutomate Execution.


User workflow() function get the workflow details like below.


{
    "id""/subscriptions/867c59c8-8ae4-4b5e-b8ac-42639cd138f8/resourceGroups/7FC0A0648A1B4AEFA1F6E9F486721D49-5FBBA43E94204DD7AEE99769217868F4/providers/Microsoft.Logic/workflows/0a2d10c7-3eff-49cf-8d28-cac30b80c938",
    "name""0a2d10c7-3eff-49cf-8d28-cac30b80c938",
    "type""Microsoft.Logic/workflows",
    "location""centralindia",
    "tags": {
        "flowDisplayName""Button -> Compose",
        "environmentName""Default-7fc0a064-8a1b-4aef-a1f6-e9f486721d49",
        "logicAppName""0a2d10c7-3eff-49cf-8d28-cac30b80c938",
        "environmentFlowSuspensionReason""Default:2D7fc0a064:2D8a1b:2D4aef:2Da1f6:2De9f486721d49-None"
    },
    "run": {
        "id""/subscriptions/867c59c8-8ae4-4b5e-b8ac-42639cd138f8/resourceGroups/7FC0A0648A1B4AEFA1F6E9F486721D49-5FBBA43E94204DD7AEE99769217868F4/providers/Microsoft.Logic/workflows/0a2d10c7-3eff-49cf-8d28-cac30b80c938/runs/08585641834146598604056559039CU16",
        "name""08585641834146598604056559039CU16",
        "type""Microsoft.Logic/workflows/runs"
    }
}

To get the Workflow Run URL use the below expression. 

workflow()['run']['id']


The output will be link, 

/subscriptions/867c59c8-8ae4-4b5e-b8ac-42639cd138f8/resourceGroups/7FC0A0648A1B4AEFA1F6E9F486721D49-5FBBA43E94204DD7AEE99769217868F4/providers/Microsoft.Logic/workflows/0a2d10c7-3eff-49cf-8d28-cac30b80c938/runs/08585641385837809218807817873CU16

This detail can be used to store for some auditing purposes or later use.

Happy Coding !

No comments:

Post a Comment