A simple way to create a trigger condition in Power Automate
Posted On March 10, 2021
“I’d like to save flow runs by adding a trigger condition to my Power Automate flow but I don’t know what the actual condition should look like.”
Trigger condition is the solution for a few Power Automate problems. The infinite trigger loop is the biggest one, but it can solve even the small problems, e.g. if your flow is running too often.
If you use a trigger ‘.. is modified’, your flow will trigger with each update. But you probably don’t want the flow to do something on each update. Most of the flow runs will do nothing, they’ll just consume a flow run while waiting for a specific update. And that’s where you can use a trigger condition, if you know how to build one.
Use ‘Filter array’ to create the trigger condition
The simplest way to build a trigger condition I found is to use the ‘Filter array’ action. The action itself is designed to do something completely different, but it offers a nice feature. You can build a condition using the ‘Filter array’ interface and then convert it into an expression with the ‘advanced mode’.
Let’s take an example: a trigger condition to trigger a flow only if choice column ‘ApprovalStatus’ has value ‘Not started’. Add the ‘Filter array’ action into your flow and enter the condition.
Then click on the ‘Edit in advanced mode’, the action will convert the condition into an expression.
An expression that you can copy and use as the trigger condition. Once you add the trigger condition, you can remove the ‘Filter array’ action.
Combine the trigger conditions
All the trigger conditions on all the lines must return ‘true’ for the flow to trigger. If you need multiple conditions, repeat the same process for each of them and place them on separate lines. The example below will trigger the flow only if ‘ApprovalStatus’ value is ‘Not started’ AND ‘Approver’ is empty.
It gets a bit more complicated when using OR in the trigger condition. As mentioned above, the lines have AND relation between them. If you need OR you must put everything on a single line. You can still use the ‘Filter array’ action to build the conditions, but you can’t use it directly. You must add the OR condition manually to connect the pieces.
@or(condition1, condition2, condition3,...)
Note: you must remove the @ from the conditions, @ should be only at the beginning.
Using the condition from the example above, ‘ApprovalStatus’ value is ‘Not started’ OR ‘Approver’ is empty.
The trigger conditions might look confusing when you see them for the first time. There’s no dynamic content available, no expressions, it’s just a free text field. But it’s a free text field expecting that you’ll know how to create the trigger condition.
Luckily, like many times before, there’s a way to make your Power Automate life easier. You don’t need to search for the column internal name or for a specific expression, ‘Filter array’ action will do it for you. Create the condition in the user interface, switch to advanced mode, and take it from there.
This post described only the trigger conditions where you’ve got empty/fixed value in a column, but you can use similar trigger conditions also to start a flow on a change in a specific SharePoint column.