Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

IF statements with multiple conditions - How to fix?

Hi all,

I am creating a new Planner task for each new SharePoint item and post to Teams, and I have the following IF statements with multiple conditions when I tried to match the Bucket ID with Stage Names.


['Stage'] is a filed from the SharePoint list, and 'KEpnFzVXWEeJk1o..', 'EBmEdXXVs0mbdsPYV' are the corresponding Bucket IDs in Planner. Although the Expression doesn't have errors, the outputs are not what I expected. From the outputs, all newly created items were assigned to the last bucket "SLDSOP90EGLabXql".


Can anyone tell me what's wrong with the code? Thank you.


if(equals(triggerBody()?['Stage'],'Sign the contract'),'KSHDMX96kmU1G77h','SLDSOP90EGLabXql')))))


My flow:

Super User
Super User

Hi @New2Flow 


The screenshot wasn't uploaded but I have a recommendation for you. Instead of having nested IF statements why don't you use the Switch action and have each individual value in a case statement. Then you Flow would be a lot more debuggable since you would see the path of your data in the History and then check if there would be any issues. 


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.


Dual Super User II
Dual Super User II

Hi @New2Flow 


Can you try to update the expression as: 

if(equals(triggerBody()?['text'],'Sign the contract'),'KSHDMX96kmU1G77h','SLDSOP90EGLabXql')))))

Note that though you changed the input name to stage, it still reads as text internally and then if you create more input fields of type text, it will be internally read as text_1 and so on. 


Also, the switch control could be a good way in case there are not too many actions depending on the input value. 


Hope this Helps!


If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,823)