cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Multiple Flow Conditions

Is it possible to have multiple conditions in one Flow? For example, I would like X to happen when Y= 2 and Z =0 (two conditions).

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Anonymous
Not applicable

Re: Multiple Flow Conditions

I think there is a better way than what Mona suggested. You can use a condition to do both at once. The syntax is something like this:

 

@and(contains(body('Get_file_metadata')?['Path'], 'Submit to Manager'),equals(triggerBody()?['Modified'], triggerBody()?['Created']))

 

This is what I'm using in a Flow to do something when the Path (from Metadata) contains 'Submit to Manager' AND when Modified = Created.

 

The easiest way I've found is to enter in one of the conditions you need in the basic mode:

1.PNG

 

 

Then click edit in advanced, and copy the string:

2.PNG

 

 

Then do the same for your second, (and 3rd, 4th, etc.) conditions:

3.PNG

4.PNG

 

 

Then put the strings together like so:

For an AND statement -

@and("String 1 without the '@'","String 2 without the '@'")

becomes: @and(contains(body('Get_file_metadata')?['Path'], 'Submit to Manager'),equals(triggerBody()?['Modified'], triggerBody()?['Created']))

 

If you want it to be an OR statement, simply change the @and to @or

 

Hope this helps!

View solution in original post

17 REPLIES 17
Highlighted
Community Support
Community Support

Re: Multiple Flow Conditions

Hi LP,

 

It is possible and easy to achieve. You can either use it like this:

 1.PNG

 

In addition, Flow supports nested conditionals, which make it possible to have very advanced branching logic. Switch case makes it very easy to have parallel branches of conditional logic based on a single value.

0.png

You can find switch by selecting the More ... option after selecting New Step and then choosing Add a Switch Case. Inside a Switch Case you will select a value from the trigger or a previous step to switch on. For example, if you use this template for a SharePoint approval flow, the switch is on the option the approver selects in the approval email. 

 

 

Let me know if this meets your requirement.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate III
Advocate III

Re: Multiple Flow Conditions

Mona, what about a multiple OR condition, like if A==1 or B==2?

Highlighted
Anonymous
Not applicable

Re: Multiple Flow Conditions

I think there is a better way than what Mona suggested. You can use a condition to do both at once. The syntax is something like this:

 

@and(contains(body('Get_file_metadata')?['Path'], 'Submit to Manager'),equals(triggerBody()?['Modified'], triggerBody()?['Created']))

 

This is what I'm using in a Flow to do something when the Path (from Metadata) contains 'Submit to Manager' AND when Modified = Created.

 

The easiest way I've found is to enter in one of the conditions you need in the basic mode:

1.PNG

 

 

Then click edit in advanced, and copy the string:

2.PNG

 

 

Then do the same for your second, (and 3rd, 4th, etc.) conditions:

3.PNG

4.PNG

 

 

Then put the strings together like so:

For an AND statement -

@and("String 1 without the '@'","String 2 without the '@'")

becomes: @and(contains(body('Get_file_metadata')?['Path'], 'Submit to Manager'),equals(triggerBody()?['Modified'], triggerBody()?['Created']))

 

If you want it to be an OR statement, simply change the @and to @or

 

Hope this helps!

Highlighted
Anonymous
Not applicable

Re: Multiple Flow Conditions

I think there is a better way than what Mona suggested. You can use a condition to do both at once. The syntax is something like this:

 

@and(contains(body('Get_file_metadata')?['Path'], 'Submit to Manager'),equals(triggerBody()?['Modified'], triggerBody()?['Created']))

 

This is what I'm using in a Flow to do something when the Path (from Metadata) contains 'Submit to Manager' AND when Modified = Created.

 

The easiest way I've found is to enter in one of the conditions you need in the basic mode:

1.PNG

 

 

Then click edit in advanced, and copy the string:

2.PNG

 

 

Then do the same for your second, (and 3rd, 4th, etc.) conditions:

3.PNG

4.PNG

 

 

Then put the strings together like so:

For an AND statement -

@and("String 1 without the '@'","String 2 without the '@'")

becomes: @and(contains(body('Get_file_metadata')?['Path'], 'Submit to Manager'),equals(triggerBody()?['Modified'], triggerBody()?['Created']))

 

If you want it to be an OR statement, simply change the @and to @or

 

Hope this helps!

View solution in original post

Highlighted
Advocate I
Advocate I

Re: Multiple Flow Conditions

Hello everyone,

Be so kind and help me, I cant figure out how to adapt your example to my situation.

I attached an example of what i should do. A simple excel file with a simple set of rules 🙂 but isnt so simple when i try to insert them into a flow.

For example, if my client debt is between 75000 and 150000 and the overdue is, lets say, 83 days, approval should go to the 6th option.

Also if i need to unblock a client for 2 months, flow condition should go to case 5 or 6, depending on the debt value and overdue. For unblocking for more than 3 months, the approval should choose case 8 or 9.

Any idea? Thats even possible? 🙂

 

And if flow cant do that, maybe if i keep just the debt and overdue cases, it is possible?

Thanks alot!!
Approvals.JPG

Highlighted
Regular Visitor

Re: Multiple Flow Conditions

Interesting, but this solution makes it hard for business users to maintain the complex WDL syntax.  I prefer Mona's solution because it retains the simple GUI editor for Flow 

Highlighted
Regular Visitor

Re: Multiple Flow Conditions

Thanks Mona for the switch case idea. 

Highlighted
Advocate V
Advocate V

Re: Multiple Flow Conditions

Switch Case is a good Idea but when the options in a list column(choice type for example) increases (more than 20 )than the GUI also becomes very tough to maintain....including all scrolling. Just a Suggestion.
Highlighted
Advocate II
Advocate II

Re: Multiple Flow Conditions

is there an easy means to look for multipe "or" options within one field?

 

like for example using the data that has been used in this thread.

Lets say that I'm looking at "path" and need a condition that helps me look for 4 or more possibilities that I want to take the same action on. 

 

if path contain= Submit to manager OR Pending Manager OR NYC OR San Fran

 

Of course I can do it with a switch case, but my flow gets extremely wide in my window and def can see how down the road this extra bulk will just complicate things.

 

thank you!!

Highlighted
Advocate I
Advocate I

Re: Multiple Flow Conditions

Thanks for great suggestion. However in my case its seems to be nor working. Following is my condition i am using 

@and(@not(equals(triggerBody()?['{FilenameWithExtension}'], triggerBody()?['{Name}'])) , @not(contains(triggerBody()?['Author']?['Claims'], 'dynadme@adobe.com')))

 a

I am getting error as -

The template validation failed: 'The template action 'Condition' at line '1' and column '1739' is not valid: "The template language expression 'and(@not(equals(triggerBody()?['{FilenameWithExtension}'], triggerBody()?['{Name}'])) , @not(contains(triggerBody()?['Author']?['Claims'], 'dynadme@adobe.com')))' is not valid: the string character '@' at position '4' is not expected.".'.

Highlighted
Advocate I
Advocate I

Re: Multiple Flow Conditions

I found the solution for my problem, following string worked for me. Basically I removed @ from @not

 

@and(not(equals(triggerBody()?['{FilenameWithExtension}'], triggerBody()?['{Name}'])) , not(contains(triggerBody()?['Author']?['Claims'], 'dynadme@adobe.com')))

Highlighted
New Member

Re: Multiple Flow Conditions

I have a custom list where i have Two columns as Start date and end date. User will be selecting future dates. For example if user selects Start date as 01/20/2019 and end date as 01/25/2019, i need to run a Recurrence flow to update a custom list column to compare todays date and if the the selected start date and end date are with in the range. I need to add two conditons to compare start date and end date, i was able to add only one condition 

Condition.PNG

Can we add two conditions as

@and(greaterOrEquals(utcNow(), items('Apply_to_each')?['StartDate']),lessOrEquals(utcNow(), items('Apply_to_each')?['EndDate']))

and compare start and end date.

 

Thanks

Highlighted
New Member

Re: Multiple Flow Conditions

dear all,

I am a new user of Microsoft flow and honestly not really a black belt software guy 🙂 I kindly ask your help to solve I believe a simple issue. I would like to save some email attachments in two separate Sharepoint folders depending on attachments. all the flows model I have seen consider only the "flagged" option but for what I have understood it is not possible to have two different type of flags. So if a flag an email, all the attchments would go in the same folder. question is: is there a way to make different type of flags or to allow with a manual action (flagging or similar) to distinguish what has to go in one folder and what in the other one ? thnaks a lot for your attention. Mauro

Highlighted
Regular Visitor

Re: Multiple Flow Conditions

Flow has now improved their condition control to allow more complex nested if/then statements and such using the visual builder. I wrote about it here: https://sharepointlibrarian.com/2019/02/05/flow-now-supports-multiple-condition-controls-for-advance...chrome_5ungBioTo9.png

 

 

Highlighted
Kudo Collector
Kudo Collector

Re: Multiple Flow Conditions

Does this work for more than 2 conditions?

Highlighted
Regular Visitor

Re: Multiple Flow Conditions

@chandrashekharis correct. Having to use switch case with scrolling sucks -- too cumbersome for more than 3 cases.

 

Why not just use the same structure as "AND/OR" and add a "CASE" choice and have the switch criteria drop down?

Highlighted
Regular Visitor

Re: Multiple Flow Conditions

switch is the answer.

 

As you pointed out, the GUI growing horizontally makes working with it difficult.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (4,384)