web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : nShLNGS+O23QUvFxNxBt19
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')

I have the same question (0)
  • Pstork1 Profile Picture
    68,271 Most Valuable Professional on 09 Mar 2021 at 16:29:40
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    The following code works for me.  You may have to play with the field names if yours are different. But this is the syntax.

    @And(equals(triggerBody()?['ApprovalStatus'], 'Pending'),equals(empty(triggerBody()?['Approvers']), false))
  • Erica0214 Profile Picture
    on 10 Mar 2021 at 06:33:54
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    Or you can just click "Add" to add more expressions, this would be taken as And as well.

  • Pstork1 Profile Picture
    68,271 Most Valuable Professional on 10 Mar 2021 at 12:24:44
    Re: Multiple criteria in one trigger condition (AND operator, etc)

    He's building a Trigger condition.  There is no "Add" in that dialog yet.  You have to build it as a string.

  • 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. 

     

     

  • Pstork1 Profile Picture
    68,271 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 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
    68,271 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.

  • eliotcole Profile Picture
    4,339 Moderator 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!
  • 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,339 Moderator 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!

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 788 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 452 Moderator

#3
developerAJ Profile Picture

developerAJ 302

Last 30 days Overall leaderboard
Loading complete