cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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!

15 REPLIES 15
Community Support Team
Community Support Team

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.
RKushner
Level: Powered On

Re: Multiple Flow Conditions

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

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!

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!

Doru
Level: Powered On

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 Smiley Happy 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? Smiley Happy

 

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

Thanks alot!!
Approvals.JPG

deolgoria
Level: Powered On

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 

deolgoria
Level: Powered On

Re: Multiple Flow Conditions

Thanks Mona for the switch case idea. 

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
chico
Level: Powered On

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!!

MakarandKeer
Level: Power Up

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.".'.

MakarandKeer
Level: Power Up

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')))

Mpkr_Kumar
Level: Power Up

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

Mauro_Sebastian
Level: Power Up

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

nchambe
Level: Power Up

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

 

 

asdfaf4
Level: Powered On

Re: Multiple Flow Conditions

Does this work for more than 2 conditions?

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 192 members 5,632 guests
Recent signins:
Please welcome our newest community members: