Fixed values in Compose instead of variables
Quiz question
Where does an email address go that never changes during the flow?
Solution
- A) In a variable, so the flow runs fasterWrong. A variable does not make the flow faster. Inside loops it even stops Apply to each from running in parallel.
- B) In a Compose action or in Parse JSONCorrect. Fixed values need no variable. Compose or Parse JSON make it clear that the value does not change.
- C) In a separate Condition at the start of the flowWrong. A Condition checks something and branches. It is not meant for storing a fixed value.
What it is about
Many flows start with a row of Initialize variable actions for values that never change: an email address, a list URL, a threshold. Fixed values do not need a variable. A single value goes into a Compose action. Several related values go into Parse JSON as one JSON object, and you read them with an expression like outputs('Parse_JSON')?['settingName']. The flow gets shorter, and everyone sees right away that these values are fixed. There is also a practical reason: when you set a variable inside a loop, Apply to each can only run sequentially. Keep variables for values that really change during the run, such as a running total.
The expression from the tip
outputs('Parse_JSON')?['settingName']When to use it, when not
Use it
For settings that stay the same during the run: addresses, URLs, thresholds, texts.
Better not
For values that change during the run, such as a total or an array you fill step by step. That is what variables are for.
Most common mistake
Marking fields as required in the Parse JSON schema that are sometimes missing. The run then fails on schema validation.
License
Standard Runs without a premium connector, so the license from Microsoft 365 is enough. Source on Microsoft Learn: Power Automate licensing FAQ. For your whole flow: License check.
Share
Short link: powerautomate.ninja/en/5
Source: PowerPlatformTip #5, Microsoft Learn: Use data operations in Power Automate.