Capture Cloud Flow Meta-Data at Runtime
  • 12 Feb 2021
  • 1 Minute To Read
  • Contributors
  • Print
  • Comments
  • Share
  • Dark

Capture Cloud Flow Meta-Data at Runtime

  • Print
  • Comments
  • Share
  • Dark

#ServerlessTips - Power Automate
Author: Kent Weare Integration MVP

Recently, I have been asked a lot of questions related to getting the information about a Cloud flow at runtime. The information people are looking for include the flow’s internal id, display name, flow instance id and the environment that it is running in.

The reason why people are interested in this information is they want to track the execution of the Cloud flows in a custom logging solution. The good news is that we have access to an expression called workflow() that will provide us with this information.

When we run the workflow() expression, we will receive a message payload with the following characteristics:

The data that is returned from the workflow() expression is quite useful. However, we need to be able to break this message down so that we can store these fields independent of each other. The good news is that we can access these attributes by using JSON parsing accessors.

For example, if we want to access the flow identifier (name) we can do so with the following expression:


When we run this expression in a Compose action, we will be able to retrieve our value

Similarly, if we want to be able to retrieve the Flow Display Name, we can do so by using this expression:


The outcome of using this expression is we get our friendly display name.

Next up, let’s retrieve our Environment Id by using this expression:


The result will be the following:

Lastly, if we want to obtain our Run Instance Id, we can do so with the following expression:


Our result is:


In this post, we discussed how we can derive runtime details about our flow. This allows us to build custom tracking solutions and include the relevant information through the use of the workflow() expression.

Was This Article Helpful?