One of the important steps in Flow is the Condition. By supplying the conditions for your Yes and No branches you can make a flow a run a set of steps or a different set of steps.
In its simplest form you choose two values and an operation.
But there is a lot more to the conditions. In this post I’m slowly going to build things up.
Basic Operations
The interface offers you 12 operations which can be used to compare values.
But there is a lot more. The get the the more advanced options we will have to switch to the advanced mode.
I’m still keeping my comparisons relatively simply by comparing 1 to 1 and 2 to 2 as I want to keep the examples simple. But you could use any of the Flow functions available as long as the result is a Yes/No. If you find that you need a non Yes/No condition then you might need to use a switch instead.
Nested conditions
Within Flow you can create nested conditions. As shown below you would have 3 different branches that could run some steps. I’ve seen many flows where conditions nested conditions have been added while only 1 branch has steps included.
Although, during debugging the above might make sense as you can see the results of each condition. For performance reasons it might help to bundle the conditions by using functions like or and and.
Dynamic content
Rather than just using values in your conditions (which is pretty boring and useless!) you can also add dynamic bits in your conditions.
While your running in basic mode you will see the link Add dynamic content which helps you doing all the complicated stuff. In advanced mode however this link disappears.
Depending on the actions above the condition that you are configuring you can click on the Dynamic content elements.
When looking at the above Date that came from the Manually trigger a flow trigger in advance mod, it becomes clear that all flow does is make it easy to find the Flow functions.
Looking at the documentation for triggerBody and equals it becomes quite easy to understand the options available within the condition:
triggerBody
Return a trigger’s body
output at runtime. Shorthand for trigger().outputs.body
. See trigger().
triggerBody()
Return value | Type | Description |
---|---|---|
trigger-body-output> | String | The body output from the trigger |
and
equals
Check whether both values, expressions, or objects are equivalent. Return true when both are equivalent, or return false when they’re not equivalent.
equals('', '')
Parameter | Required | Type | Description |
---|---|---|---|
object1>, object2> | Yes | Various | The values, expressions, or objects to compare |
Return value | Type | Description |
---|---|---|
true or false | Boolean | Return true when both are equivalent. Return false when not equivalent. |
There is more however. To collect information from previous steps there are a few more functions that are important. Just to list a few:
- action or actionsBody
- variables
- outputs
Conclusions
Rather than just going for the drag and drop options in Flow. It is worth investing some time in reducing the number of conditions just to ensure that the flow diagram is reduced in size. By reducing the number of conditions flows might be a bit more efficient but above all easier to understand as the overall diagram becomes smaller.
Hi Peter,
I’m quite sure you didn’t want to hide the documentation for triggerBody and equals functions behind HTML code 😉
Thanks Sergio. I fixed that now.