Power Automate Standards: Variables

Power Automate Standards: Variables
Table of Contents
• How Should I Store Values In A Flow?VariablesCompose ActionEnvironment VariablesConfiguration Data TableGet A Single Key-Value Pair From Configuration DataRetrieve All Key-Value Pairs For A Configuration Data Group

How Should I Store Values In A Flow?

Variables, the Compose action, and Environment Variables, and Configuration Data all have a useful role to play in Power Automate flows. This section discusses where and when to use each of them.


Variables store values that can be referenced in other flow actions. Use a variable when the value will need to be updated at multiple points during the flow run.

Avoid creating variables to store constants. A constant is a value supplied when the variable is initialized that does not change during the flow’s execution.

Do use a variable to store the result of a calculation. Do not use variables when a direct reference can be made in the flow action.

Compose Action

Variables cannot be used inside of Apply To Each loops when in Concurrency enabled. Substitute the Compose action for variables inside to loops to maintain the performance benefit of parallelism.

When a value is stored inside of a Compose action it cannot be updated. Only use it to store values that will not change.

The Compose action is often cited as an alternative to Power Automate variables. Don’t overuse this technique. Compose actions can make flows less readable at a glance because they always show the word Output when referencing a prior action.

Environment Variables

A developer following ALM best practices will create flows in a development environment, then move the flow to a testing environment for testing and into a production environment for go-live. The flow will often need to behave differently in each environment. Use environment variables to store configuration values and avoid hardcoding them into the flow. Editing a flow inside a managed solution will cause an unwanted unmanaged layer to appear.

For example, a flow sending an email targets an email distribution list while in production but only sends messages to the developer while in development and test environments.

Leverage a single environment variable to replace several of the same hardcoded values across multiple flows.

Configuration Data Table

An environment variable should not be created when it will only be used in a single flow. Instead, create a table called Configuration Data and use it to hold key-value pairs containing the flow settings.

The Configuration Data table includes the following single-line text columns:

  • Key – describes the key-value pair, must be unique to the group.
  • Value – the value to be used inside the flow
  • Group – identifies a set of key-value pairs, making it possible to get all needed key-value pairs at once

1DistributionList[email protected]DailyNotificationsFlow
4OutputFolderC:/Documents/Sales ReportsGenerateReportFlow

Replace as many hardcoded values in a flow as possible. This will eliminate the need to redeploy a flow to make changes to its behavior.

Get A Single Key-Value Pair From Configuration Data

A single value key-value pair can be obtained using the Get Item (SharePoint) or Get Row (Dataverse) action.

To use the configuration data value select it from the dynamic content menu.

Retrieve All Key-Value Pairs For A Configuration Data Group

All key-value pairs for a group (e.g. DailyNotificationsFlow) can be retrieved using this flow pattern.

The following expression is used in the Compose: Key-Value Pairs Object flow action.

first(json(replace(replace(string(body('Select:_Key-Value_Pairs')), '},{', ','),'null,','"",')))

Configuration data values for the group can be accessed in the dynamic content menu.


If you have any questions or feedback about Power Automate Standards: Variables please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Notify of

Inline Feedbacks
View all comments
4 months ago

“Variables cannot be used inside of Apply To Each loops when in Concurrency enabled. Substitute the Compose action for variables inside to loops to maintain the performance benefit of parallelism.”

Awesome tip. I have always used variables by default, but started wondering what the point of Compose really was. Removing all the variables inside my loop reduced time to run flow from 52 seconds to 8! Many thanks 🙂

Gianluca M
Gianluca M
4 months ago

Many thanks for the great summary on this! But:

“Do not use variables when a direct reference can be made in the flow action.”

For me this is not a yes or no. While direct references might be faster, sometimes I still use variables to make the flow easier to understand. I would use Compose instead, if there would be an option to name the output, but that’s currently not possible.