The Compose action
- Ajith Madathil
- Mar 28, 2020
- 1 min read
Updated: Apr 1, 2020
Microsoft Power Automate (aka Microsoft Flow) provides lots of action steps out of the box. My favourite one is Compose. What does it do?
What is the Compose action?
The Compose action is like a static variable. It can be placed anywhere within your flow, and its value can be accessed from anywhere within the flow.
The value is persistent – once it is set it cannot be changed. The value of the Compose action can be the result of an expression, or be a ‘regular’ value that you assign yourself (e.g. a string, integer etc).
How we can use the Compose action
Example #1

This action will output today’s date. The expression I am using as the input is:
formatDateTime(utcNow(),'dd-MM-yyyy').
If we run this, we will see:

Example #2
Now let us try using a Compose action inside of a loop.
First we declare a new Compose action (Compose 2) using the expression addDays(utcNow(), 1, 'dd-MM-yyyy'). This will output tomorrow’s date.
Next we also declare a Boolean variable (named Stop) to stop the loop after one iteration.
Our flow now looks like this:

Running it gives us this output:

Example #3
Now we will extend our flow to use the output of both Compose actions. Note how one Compose action is inside of the Do-while loop, and one is outside. The output of either one can be accessed from anywhere in our flow.

Please note how the Compose 3 action (outside of the loop) is set to the output of Compose 2 (which is inside of the loop)!
Here is the output of the completed flow:

Recent Posts
See AllI have a SharePoint document library called aj, and inside of it, three folders (Test1, Test2 & Test3). I am going to build a flow to...
In this blog post I will access NASA's Astronomy Picture of the Day (APOD) API using Power Automate. The plan is to retrieve the picture...
Every flow needs a trigger to start with so here I am using a manual trigger. Next, I am using the action List Folder which returns files...
Comments