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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Multiple values to loo...
Power Automate
Answered

Multiple values to look for in an IF Contains expression

(0) ShareShare
ReportReport
Posted on by 5

 

Hello,

 

I'm building a flow that gets the response from a form and adds it to an email, which content changes based on a selected value.

 

Instead of creating multiple scenarios using CONDITION/SWITCH, I created a string variable in which I'm adding all the scenarios as IF expressions with Contains to look at the selected value submitted with the form. The image shows what I'm describing, however I will likely have +30 scenarios, which explains why I don't want to rely on CONDITION/SWITCH.

 

sclement_0-1665682971069.png

 

My strings look like this:

 

if(and(contains(outputs('Get_response_details')?['body/XXXXX'],'COUNTRY1'),contains(outputs('Get_response_details')?['body/YYYYY'],'PRODUCT1')),body('CONTENT'),'')

 

So, if response from XXXXX contains COUNTRY1, and response from YYYYY contains PRODUCT1, then display CONTENT 

 

However, I would like that if response from XXXXX contains COUNTRY1 or COUNTRY3 or COUNTRY5, and response from YYYYY contains PRODUCT1, to display CONTENT

 

it's the OR part that I can't figure out.

 

I thank you in advance for your help!

Categories:
I have the same question (0)
  • Verified answer
    v-liwei-msft Profile Picture
    Microsoft Employee on at

    Hi @sclement 

     

    You just need to add the or function to the and function.

    if(and(or(contains(outputs('Get_response_details')?['body/XXXXXXX'],'COUNTRY1'),contains(outputs('Get_response_details')?['body/XXXXXXX'],'COUNTRY3'),contains(outputs('Get_response_details')?['body/XXXXXXX'],'COUNTRY5')),contains(outputs('Get_response_details')?['body/YYYYYY'],'PRODUCT1')),body('CONTENT'),'')

     

    Best Regards,

    Levi

  • sclement Profile Picture
    5 on at

    Wonderful, Levi! It worked like a charm!

     

    Thank you for your quick reply.

    Sacha

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard