cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RamiAlouta
New Member

If condition in flow with multiple "or".

Hello Flowers,

 

I am trying to write an if condition that should be true if it means 1 of 15 different answers.

 

My research showed me that it should look something like this yet I am not sure that this is working! any help?

 

@or(equals(triggerBody()?['feature']?['attributes']?['inspector'], 'user1'), or(equals(triggerBody()?['feature']?['attributes']?['inspector'], 'user2'), or(equals(triggerBody()?['feature']?['attributes']?['inspector'], 'user3'))))

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi @RamiAlouta,

 

I assume that you would like to combine multiple if conditions within one statement.

 

Please check the following code which will return corresponding value based on the input value:

if(equals(triggerBody()?['Title'],'test1'),'test1',if(equals(triggerBody()?['Title'],'test2'),'test2',if(equals(triggerBody()?['Title'],'test3'),'test3','test4')))

 1.PNG

Please take it for a reference and try it on your side.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yamao-msft
Community Support
Community Support

Hi @RamiAlouta,

 

I assume that you would like to combine multiple if conditions within one statement.

 

Please check the following code which will return corresponding value based on the input value:

if(equals(triggerBody()?['Title'],'test1'),'test1',if(equals(triggerBody()?['Title'],'test2'),'test2',if(equals(triggerBody()?['Title'],'test3'),'test3','test4')))

 1.PNG

Please take it for a reference and try it on your side.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Some small edits since I am using the survey123 connector!

 

It should look something like this:

 

@if(equals(triggerBody()?['feature']?['attributes']?['field_0'], 'user1'), true,if(equals(triggerBody()?['feature']?['attributes']?['field_0'], 'user2'), true, false))

Nunzie
Helper III
Helper III

Hello, I was looking to do this as well, and went off the answer provided. I'm clearly doing something wrong because it is making a flow that worked fine without multiple criteria now crash.

 

I'm making an approval flow. What I'm trying to do is determine who the approval is sent to based on who requested it, as there are two individuals that go to one manager, everyone else goes to another.

 

The one that allows the flow to successfully run (but is missing Name 2 going to Manager 1 email) is:

if(equals(triggerBody()?['Author']?['DisplayName'], 'Name 1'), 'Manager 1 email', 'Manager 2 email')

 

So I tried to amend it based on the answer above to:

if(equals(triggerBody()?['Author']?['DisplayName'], 'Name 1'), 'Manager 1 email', if(equals(triggerBody()?['Author']?['DisplayName'], 'Name 2'), 'Manager 1 email', 'Manager 2 email'))

 

When making that one amendment the flow then fails. I haven't changed any other part of the flow, just that calculation. When I put it back to how it was previously it then works fine again.

 

Any insight would be greatly appreciated.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,683)