“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
AND
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.
OR
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.
@or(equals(triggerOutputs()?['body/ApprovalStatus/Value'], 'Not started'),equals(triggerOutputs()?['body/Approver'], null))
Summary
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.
Thank You for Your post!
What to do when I interested in a free text field change? There is no predefined status to look for, it is just a text box where the users add updates. I wouldn’t start the flow for each modification, just when that given field has changed. Using Your method, I received this:
“@equals(outputs(‘Get_changes_for_an_item_or_a_file_(properties_only)’)?[‘body/ColumnHasChanged/Requisition_x0020_Notes’], true)”
Hello Sebastian,
to monitor changes in a free text field you’ll need a ‘backup’ column, one extra column where you’ll store the original value and compare it with the ‘main’ free text column on every change. I already wrote a post on this that I believe will explain the solution in more detail: https://tomriha.com/how-to-trigger-power-automate-flow-on-specific-sharepoint-column-update/.
Hello very interesting these points!
How would a trigger of this type be for an Azure trigger, that is when a work item is updated with the status = CAB Submitted, and the field Crtl Verification = Submitted?
And subsequently prevent this from running infinitely?
Thank you very much in advance.
Hello Amaury,
I didn’t work with Azure triggers so I don’t know if it’s done differently than this.
Great sharing! This helped me to resolved my issue that I only want my approval flow trigger while the stage & status under specific value and update the stage & status to another value after approval. Thanks for sharing such great solution 🙂
This solution was super simple and worked perfectly, thank you!
Once I read this section of the page, https://docs.microsoft.com/en-us/power-automate/triggers-introduction#customize-a-trigger-by-adding-conditions , I was concerned. I’m preparing to teach Power Platform to users in a large, global company, and this seemed important! That link didn’t work until I changed the https to http. Meanwhile, I found your article here. Then I reached that other article and it was super complex! I’ve recommended this article as a replacement for it in my feedback suggestion.
I would love to hear your thoughts on triggering a flow based on a choice field with multiple selections. Basically, I have a field where people can choose more than one option: Red, Green, Blue. I want the flow to trigger if Red is one of those choices. I cannot figure out how to make that work, even when I use the filter array to build the expression. Any advice is appreciated!
Hello Nikki,
my thoughts on this are in the new post, I hope it helps.
The same thing happens to me, I would like to know how to execute a flow depending on a column of options in my case my column of options is quite simple with a YES or NO, but because I do the step of filtering the matrix I cannot make it activate :(, you could find the way?
Hello Esteban,
I wrote a new post regarding multiple choice columns, but in your case it sounds like a single choice column. In that situation you just need to use the ‘Column Value’ dynamic content when building the condition in the ‘Filter array’ action.
This is great! Thank you so much. Very useful.
Great share. Love your Blog.
I’m trying to build a trigger condition on a scheduled trigger. The flow runs weekly, but I only want it to run if the Status column of any item is “Active”. If they are all “Inactive” then the flow should not run. The problem I’m having is the ability to specify the list to reference. I can build the condition based on the above for fields and values(which is great!), but it leaves out the list. A scheduled trigger is not tied to a list, so there is nothing to pull from.
@equals(triggerOutputs()?[‘body/Status/Value’], ‘Active’)
Hello Chad,
you’re right, there’s no trigger that would be directly tied to a list, therefore, it’s not possible to build a trigger condition like that. You’ll have to trigger the flow every week and check if there’re any active items as the first step in the flow (and end it if there aren’t any).
Thanks for this. Very helpful and clear. Do you know if you can set a trigger condition to depend on a value in a related entity? E.g. if it was an Income Line, to be able to trigger if the related Income Record (1:1 relationship with Income Line) has a Campaign of a certain value?
Hello Simon,
you can check two columns in the same item in a trigger condition, but if it’s not possible to use values from different items.
Hello, my “When an item or a file is modified” trigger already uses Array: @triggerOutputs()?[‘body/value’] and Trigger Condition @contains(triggerBody()?[‘{FilenameWithExtension}’],’.xlsm’).
I’m trying to use your instructions to add to that, an AND and OR condition. My condition is:
If Content Approval Status = Approved AND Checked Out = false
OR
If Content Approval Status = Denied AND Checked Out = false.
I see what you mean about how to code it for AND. I get what you mean about how to code it for OR. I’m not seeing how to code it for both AND and OR.
My trigger condition that is already in there I’m guessing would just be an AND, if I could figure out how to do both.
@contains(triggerBody()?[‘{FilenameWithExtension}’],’.xlsm’)
AND
@equals(triggerOutputs()?[‘body/{ModerationStatus}’], ‘Approved’) AND @equals(triggerOutputs()?[‘body/{IsCheckedOut}’], false)
OR
@equals(triggerOutputs()?[‘body/{ModerationStatus}’], ‘Denied’) AND @equals(triggerOutputs()?[‘body/{IsCheckedOut}’], false
I’m not clear on how to nest the 2 AND conditions in to the OR condition. 🙂
Hello Tonie,, ),),and(,))
the relation between rows is always AND, so if you need to combine them with OR then everything must be on the same line. You’ll just have to put it all together using brackets in the right place.
@or(and(and(
This is a lifesaver-thanks!
This has got to be the best “go-to” list for Power Automate flows so I am hoping you can help me figure out what I am doing wrong.
I have three flows on a list that run when specific fields are modified:
1) An email notification is sent when an entry is created
2) An email notification is sent when the field “Quantity Approved” is not blank (Someone enters an amount)
3) An email notification is sent when the field “Quantity Received” is not blank (Someone enters an amount)
I set the triggers for the second and third flow so they will run only when the required fields are not blank but both the second and third flows run anytime the entries are modified. These are simple flows so I am sure I am missing something. Any ideas?
Hello Ann,
you’ll have to add at least one more condition in the trigger, if you check only whether a column has a value it’ll run with every modification (as the column already has a value). I’d expect that your solution has some column with “Status” for a quick overview of the status of the request, or it would make sense to add one.
It could have status like “New”, “Approved”, “Received”. First flow will set status “New” upon completion. Second flow will trigger if the status is “New” and the field is not empty and set the status to “Approved”. Third flow will trigger if status is “Approved” and the field is not empty, and set the status to “Received”.
I described similar solution with approval status column here: https://tomriha.com/how-to-run-a-power-automate-flow-only-once-after-sp-column-has-a-value/
Hi, Tom, Eliot here … I only scanned the comments, just thought I’d note … if this is a choice column that you’re basing it on shouldn’t the following be a more appropriate equals() function?:
equals(triggerOutputs()?[‘body/ApprovalStatus’][0]?[‘Value’], ‘Not started’)
Hello Eliot,
if you add the index in the expression as you did then you expect it to be multiple selection choice column and you’re checking only the first value. For single choice you don’t need the index [0]. But the main point of this post is that you don’t really need to know what’s the “best way” as the action will create the trigger condition for you.
How can I extract data from a PDF and add a row of data into multiple tables across different spreadsheets, based on the document contents?
Hello Andre,
no idea, I never extracted data from PDF, but I’d check AI builder or Forms recognizer in Azure to get data from PDF.
Great Share for Trigger Condition.
Hi.
I’ve had great success with a status column that need to read ‘Submitted’ to trigger.
Thanks for this.
However I still receive the warnings in Flow checker about the potential for the infinite loop.
This shows up on a solution checker as a warning, and needs to be defended in production readiness assessments..
Is there any way to tell the flow that there is a considered trigger limitation in place, and the infinite loop potential has been successfully truncated, so it can stop reporting the warnings?
Hello Ian,
the infinite trigger loop warning doesn’t care about the trigger conditions, I didn’t find any way how to disable it, it always there even when you deal with it. I agree it’s very annoying (almost as much as the ‘Get items’ warning agains high number of items returned), but it’s just a warning, not an error.
Hi.
I have SharePoint list having so many fields, I want flow trigger when item created or modify in some specific fields.
Hello Dilip,
take a look on this article: https://tomriha.com/how-to-trigger-power-automate-flow-on-specific-sharepoint-column-update/