• Ajith Madathil

The Compose action

Updated: Apr 1

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:





0 views
Blog Categories
 

Beginner

Intermediate

 

Advanced

Power Automate Essentials

How can I help you?

I am happy to help at any time.  You can contact me via the official PowerAutomate community forum.  Tag me (@abm) on any post you make there if you would like to me take a look at it.

I am always available for both corporate training or 1-2-1 training for individuals. 

© 2023 by Walkaway. Proudly created with Wix.com

  • Twitter Black Round
This site was designed with the
.com
website builder. Create your website today.
Start Now