Very often I hear flow people telling others that we should use Compose actions instead of variables. But when you reference a compose action it just shows “Outputs”.
The Compose action
When you want to structure data or use data you can put it in a compose action and then use it at a later stage in your flow.
A while back I looked at some alternatives in my post Compose or Variables or neither
Both purple actions in the above flow are compose actions. The first action is called Important data, while the second action is using this data. When you look at this flow in 6 months time can you still remember what that second action is doing?
Yes, you could hover over the Outputs and a tool tip will show you that Important data is referenced. But this is not ideal if you want to understand a flow with many actions in it.
How can we make the compose references self documenting?
Alternative way of referencing compose actions.
To make the Compose action self documenting we will first need to have a look at the first compose action.
How about structuring our data a bit more. So that a json object is created by the compose. remember whatever we put into this compose is what we will see in the output.
Now we can reference in the second Compose the More Important Data in the first Compose action using the following expression:
outputs('More_Important_Data')?['More Important Data']
When you initially edit the flow you will still see the outputs expression, but when you reload the flow all the magic will have happened.
Now we can see which compose is being referenced. ok, there is one small downside as you might have to type the expressions and yes you could use the parse json action if you wanted to avoid the typing, but once you get used to the syntax it isn’t that much of a problem that you can’t use the Dynamic Content.
Multiple settings in one Compose
You could if you wanted to even put multiple properties in one compose so that you can avoid multiple boxes. This avoids having many variables/compose actions at the beginning of your flow cluttering the flow.