In a Power Automate (flow), we can limit when the flow is triggered using several different methods. This blog post will highlight two methods a maker can employ to limit flow runs using trigger conditions. Using trigger conditions allows a maker to create multiple conditions that must be met for a flow to be triggered. Please note that if a flow’s trigger conditions are NOT met, the flow will not be triggered, and no run history will be logged.
Option 1 – Filter rows conditions on the trigger action:
A maker can limit a flow’s triggering via the Filter Rows property under Advanced Options of the trigger step.
Here we use an oData query statement to control when the flow triggers. This option can be difficult to implement and usually only allows a single filter. Using an AND or OR operator to combine conditions will most likely not work. Therefore, let’s explore an alternative and easier method for combining multiple trigger conditions, described in Option 2 below.
Option 2 – Set trigger conditions on the trigger action:
A maker can limit a flow’s triggering via the settings of the trigger component. Please see the step-by-step instructions below.
- Click on the plus sign under the trigger component and click Add an action to add a new step
- Type “filter array” in the search box and then select the action from the results
- Once the Filter array action is created, add your required trigger condition. Ignore the From field as we won’t be saving this step. We’ll only be using it to compose our filter criteria.
- Click Edit in advanced mode and copy the text in the textbox
- Now that we have the correct syntax for our first filter, we need to paste it into the settings. To do that, click on the ellipsis in the upper right corner of the trigger component
- Click Add and paste the clipboard contents into the trigger condition field.
If you have multiple filter conditions to add, you can click the +Add button and repeat steps 3-4 above to generate the properly formatted conditions. However, if you need to have OR logic, you need to put that in one line like this: @OR(test1,test2,test3). Note that we drop the leading @ of each string and put that at the beginning.
For example, if we wanted to have our trigger filter if a task
- has a subject,
- and the due date is > today
- and the status is not canceled,
our syntax would look like this (carriage returns added for readability):
Finally, once you have completed the setup of the trigger conditions you can delete the filter array option and complete any additional steps required for your flows use case.