Skip to main content

Notifications

Community site session details

Community site session details

Session Id : z+a9gkb14IMo9ZQEnlyu20
Power Automate - Building Flows
Unanswered

Multiple criteria in one trigger condition (AND operator, etc)

Like (0) ShareShare
ReportReport
Posted on 9 Mar 2021 15:51:10 by

Hi there. I don't expect this to be super complicated but I'm not totally clued up on Flow expressions just yet and have a question. I have a Sharepoint Created / Modified trigger and I currently have a handful of Condition > Terminate functions to kill off the flow under certain conditions, and would like to make use of trigger conditions instead in order to save flow runs. I'm just trying to wrap my head around the terminology though. Could someone clarify what the actual expression would be if I wanted the flow to ONLY run when:

STATUS column = Pending Approval
AND
APPROVER column contains information

It's pretty simply doing this with the terminate condition, and I know / think the beginnings of the expression will be something along the lines of the below, but expanding this to accommodate the two pieces of criteria with AND operator I'm unsure about. Can anyone advise?

@equals(triggerBody()?['STATUS']?['value'],'Pending Approval')

  • AntoinetteB Profile Picture
    145 on 07 Jun 2022 at 14:37:40
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    Hi, thank you for the tips.  I'm the only one at the bank who creates flows and I'm not technical.  I never annotate anything.  I go back and open a previous flow and look at what I did before and then use that to refresh my memory on how to solve a new challenge in my latest flow.  I'll have to look into leaving myself some notes in the future. 🙂

  • eliotcole Profile Picture
    4,218 Super User 2025 Season 1 on 02 Jun 2022 at 15:55:59
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    👍👍👍👍👍👍👍

     

    Oh, seriously, don't worry about it ... I operate on the assumption that I'm the least important person in a room, so it's relatively hard to irk me.

     

    I still think you're absolutely right, though, that it needs a better interface.

     

    I didn't know about all the articles online telling folks how to make the trigger conditions using the Filter action. But believe you me, I'll be repeating it again on this place. 😅

    ----

     

    With regards to what you're saying, though, I feel your pain.

     

    Just remember, though, each Trigger Condition is adding an extra condition to an invisible and() expression. 😉

     

    ----

     

    Also, I am new to coding myself. On the surface of it, I believe that (in general) Power Automate flows should be made so that anyone could possibly look at the flow and understand what is happening.

     

    That is why if it's a flow made by a member of staff that isn't perhaps in a technical role, for the benefit of other members of staff, then it should be a simple as possible. I mean we're trying to get AWAY from those darned spreadsheet formulas, here! 

     

    If I can offer one little nugget, there, though ... if you ever find that you've spent a long time on either some complicated logic, or that you've used an expression anywhere in a flow ... try to annotate that. Either purely by pasting the complicated expression in the 'Add a note' section of an action, or by talking through what's happening in the same field.

     

    In coding I'm sure the equivalent is to add comments to your code to annotate it.

  • AntoinetteB Profile Picture
    145 on 02 Jun 2022 at 15:11:53
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    I am someone new to expressions.  I don't code at all.  And I've been experiencing the very problem I'm talking about where it actually did not work effectively.  I'm speaking to my own reality.  LOL I was trying to say that there are so many articles where people tell you how to hit the Advanced link on the Array action to create the expression and then delete the array, but not much to help to combine all the nested and/or.  I actually created an official suggestion for this a few minutes ago with Microsoft because I doubt I'm the only no code person relying on the generosity of people like pstork and yourself for the code to put in. 

     

    Thank you so much for the second spoiler.  This helps me learn how to code; kind of like training wheels.  I had already taken pstorks code he gave me and looked at it against my Condition action UI to see how it matches up and how to structure that on my own.  I will also use your spoiler to add my my arsenal of when I have to code in order to use Power Automate effectively.   (Except that my scenario request AND and OR, not one or the other but both.) Also, I think I might have thought you were responding to my question to pstork along with the original person, which was not just to convert to an expression, but you were really only talking to him.  My confusion, the replies here are sometimes hard for me to follow.  🙂  

  • eliotcole Profile Picture
    4,218 Super User 2025 Season 1 on 02 Jun 2022 at 14:36:13
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    It isn't supposed to help with combining, @AntoinetteB, the list of Trigger Conditions is inherently an and() wrapper.

     

    You're right, though, about using that Condition action front end, it does need that.

     

    When someone is just starting out learning this stuff then it's far more applicable to:

    1. Make one trigger condition using the Filter method, add it as a trigger condition.
    2. Make another trigger condition using the Filter method, and add that as another trigger condition, too.

    See below spoiler for how that might look:

    Spoiler (Highlight to read)

    multipleTriggerConditions.jpg

    Now this will trigger only if 'Status' = "In progress" and 'Priority' = "High" ... or in expression terms:
    and(
     equals(
     triggerOutputs()?['body/Priority']?['Value'], 
     'High'
     ),
     equals(
     triggerOutputs()?['body/Status']?['Value'], 
     'In progress'
     )
    )
    So if I really wanted to, I could just have one Trigger Condition of:
    @and(equals(triggerOutputs()?['body/Priority']?['Value'], 'High'), equals(triggerOutputs()?['body/Status']?['Value'], 'In progress'))
    Now this will trigger only if 'Status' = "In progress" and 'Priority' = "High" ... or in expression terms: and( equals( triggerOutputs()?['body/Priority']?['Value'], 'High' ), equals( triggerOutputs()?['body/Status']?['Value'], 'In progress' ) ) So if I really wanted to, I could just have one Trigger Condition of: @and(equals(triggerOutputs()?['body/Priority']?['Value'], 'High'), equals(triggerOutputs()?['body/Status']?['Value'], 'In progress'))

    Saying something like this could make a person new to the system doubt that it will work effectively, which isn't fair on them, Antoinette. Because something like this does work, especially for helping people new to expressions to add a simple Trigger Conditions.

     

    What it *doesn't* do is help with an or() Trigger Condition. If someone new to expressions, who is still uncomfortable with the expression builder, then they may still wish to use the filter method.

     

    An or() trigger can still be made, though, but it is *technically* writing an expression. The easiest way to do this using the Filter method would be what I've plotted out in this spoiler, which one could also use for and():

    Spoiler (Highlight to read)
    1. Open a notepad and type the following on the first line:
      and(

       

    2. Add another line and type the following on the new line:
      )

       

    3. Make a condition using the Filter method.

    4. Copy that condition on to a new line inbetween the 'and(' and ')' lines

    5. Repeat #3 and #4 for as many conditions needed.

    6. Once done, add a comma to the end of condition, except the last one.

    7. Go to the ')' line, and begin to consolidate the lines into one by backspacing from the start of each line.

    8. You have an or() condition!
    Open a notepad and type the following on the first line: and(   Add another line and type the following on the new line: )   Make a condition using the Filter method. Copy that condition on to a new line inbetween the 'and(' and ')' lines Repeat #3 and #4 for as many conditions needed. Once done, add a comma to the end of condition, except the last one. Go to the ')' line, and begin to consolidate the lines into one by backspacing from the start of each line. You have an or() condition!

     

  • AntoinetteB Profile Picture
    145 on 02 Jun 2022 at 12:22:36
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    Sadly that does not help with combining multiple trigger conditions.  It just gets you the trigger conditions to start with and you have to figure out how to combine them yourself.  It makes me think though, if you can use a Condition action and neatly put in all your "and" and "or" conditions without code, I wish Microsoft would use that same Condition screen in the trigger condition.

  • eliotcole Profile Picture
    4,218 Super User 2025 Season 1 on 01 Jun 2022 at 21:48:45
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    @Anonymous , I'm sure you've got a good answer below, but if you want a really easy way to go about making a trigger condition, just use a filter to make it, tap the 'advanced' link, and copy the formula out of that!

     

    I've copied a step by step for this in the below spoiler (supplied to a user who was similarly wary about expressions) which should guide you through just how easy it is:

    Spoiler (Highlight to read)

    Trigger Condition

    You need this here to ensure that this flow doesn't run for every single change on the list.

     

    Follow these steps to easily create a trigger condition:

    1

    Add an action

    Select a point anywhere in the flow and choose 'Add an action', then 'Data Operation'.

    1 - Add an action.jpg
    2

    Filter array

    Select 'Filter array' from the choices.

    2 - Filter.jpg
    3

    Select column

    In the left side of the Filter array condition insert a Dynamic Value, and select your desired column.

     

    In this example we're choosing 'Status', which is listed as 'Status Value' as it is a choice column on my list.

    3 - Pick Column.jpg
    4

    Enter the condition text

    Now in the middle you choose your condition logic, in this case, you wish to ensure that the column is equal to a value that you state, so you choose 'is equal to' here.

     

    Then on the right side you want to place the value that you wish the trigger of the flow to fire upon. So here you either type, or copy directly from the list settings the value that you need to match.

    4 - Enter text.jpg
    5

    Edit in advanced mode & Copy Text

    Tap 'Edit in advanced mode' and copy or cut all the text from that box using CTRL+A to ensure it's all selected.

    5 - Tap 'Edit in advanced mode' and cut all the text.jpg
    6

    Delete the Filter array

    Tap the three dot menu on the Filter array, and select 'Delete'

    6 - Delete the Filter array.jpg
    7

    Go to Trigger Settings

    Tap the dot menu on the trigger and select 'Settings'

    7 - Tap the dot menu on the trigger and select 'Settings'.jpg
    8

    Paste Trigger Condition

    Look to the bottom of the Trigger Settings you will see the Trigger Condition section.

     

    Add a new Trigger Condition and paste the details that you cut from the Filter inside it.

    8 - Add a Trigger Condition and paste the details that you cut from the Filter.jpg

     

    Congratulations, you have made your first trigger condition!

    🏆

    Trigger Condition You need this here to ensure that this flow doesn't run for every single change on the list.   Follow these steps to easily create a trigger condition: 1 Add an action Select a point anywhere in the flow and choose 'Add an action', then 'Data Operation'. 2 Filter array Select 'Filter array' from the choices. 3 Select column In the left side of the Filter array condition insert a Dynamic Value, and select your desired column.   In this example we're choosing 'Status', which is listed as 'Status Value' as it is a choice column on my list. 4 Enter the condition text Now in the middle you choose your condition logic, in this case, you wish to ensure that the column is equal to a value that you state, so you choose 'is equal to' here.   Then on the right side you want to place the value that you wish the trigger of the flow to fire upon. So here you either type, or copy directly from the list settings the value that you need to match. 5 Edit in advanced mode & Copy Text Tap 'Edit in advanced mode' and copy or cut all the text from that box using CTRL+A to ensure it's all selected. 6 Delete the Filter array Tap the three dot menu on the Filter array, and select 'Delete' 7 Go to Trigger Settings Tap the dot menu on the trigger and select 'Settings' 8 Paste Trigger Condition Look to the bottom of the Trigger Settings you will see the Trigger Condition section.   Add a new Trigger Condition and paste the details that you cut from the Filter inside it.   Congratulations, you have made your first trigger condition!
  • Pstork1 Profile Picture
    66,091 Most Valuable Professional on 01 Jun 2022 at 21:19:13
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    Its not really a specific language since this is a low code/no code system.  the closest would be Excel or Azure Logic app functions.

  • AntoinetteB Profile Picture
    145 on 01 Jun 2022 at 18:35:56
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    Thank you so much!  It never occurred to me to try to separate it out on different lines to make sense of it.  Although that's what I do when I have to fool with VBA in Excel.  BTW not a big deal but do you know what kind of code this is that we use in Power Automate?  Just this one time I happened to ask one of our developers for help with this, and he could not help, but he said I could get back to him if I knew what language it was.  I just Initialize Variable and hit Advanced and copy/paste the expression it gives me.  But I don't know what language it is.

  • Pstork1 Profile Picture
    66,091 Most Valuable Professional on 01 Jun 2022 at 18:19:59
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    You just nest the conditions as needed. 

    @And(
     contains(triggerBody()?['{FilenameWithExtension}'],'.xlsm'),
     or(
     and(
     equals(triggerOutputs()?['body/{ModerationStatus}'], 'Approved'),
     equals(triggerOutputs()?['body/{IsCheckedOut}'], false)
     ), 
     and(
     equals(triggerOutputs()?['body/{ModerationStatus}'], 'Denied'),
     equals(triggerOutputs()?['body/{IsCheckedOut}'], false)
     )
     )
     )
  • AntoinetteB Profile Picture
    145 on 01 Jun 2022 at 15:00:49
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    Hello, I see there is now a +Add function built into the Trigger Conditions so you don't have to build it into the string.  Unfortunately I need to put both AND and OR into one string.  

     

    I'm already using Array: @triggerOutputs()?[‘body/value’] and Trigger Condition @contains(triggerBody()?.

     

    I want to expand the trigger condition to this:

    @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'd be most appreciate if you're able to help:

    1) I’m not clear on how to nest the 2 AND conditions in to the OR condition. 

    2) I'm not clear on whether I need to make any changes to the @triggerOutputs()?[‘body/value’] that is in the Array field because I added the original trigger condition so long ago I don't recall why I added that Array. 

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started