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 / Add e-mail recipient b...
Power Automate
Unanswered

Add e-mail recipient by if statement

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a send email action and want it to check an array (attachments to the email) for a specific word (in filename), and if that exists, add an email to CC.

 

I'm not sure how to write it, concat was the closest thing to a "add text"-function I could find.

Spoiler (Highlight to read)
if(contains('BrandlarmVCCAtt'), 'SATS'),concat('nicki.vike@sats.se')
if(contains('BrandlarmVCCAtt'), 'SATS'),concat('nicki.vike@sats.se')

Any ideas on how to get it to work? Ideally directly in the CC-field with extra variables and Compose-actions.

 

b1tz_0-1650990492655.png

 

Categories:
I have the same question (0)
  • joelzehring Profile Picture
    208 on at

    I think you're on the right track. Just need to change the syntax a little.

     

    if(contains(string(variables('attachmentArray')), 'BrandlarmVCCAtt'), 'name@test.com', '')

     

    The if expression takes three arguments. In this situation, the first argument is the conditional presence of a substring inside a string is the condition. The second argument is what to return if the condition is true (an email string). The third argument is what to return if the condition is false (an empty string). Source: Reference guide for expression functions - Azure Logic Apps | Microsoft Docs

     

    The contains expression takes two arguments. In this situation, the first argument is the string you want to search within, and the second argument is the substring you're search for. Source: Reference guide for expression functions - Azure Logic Apps | Microsoft Docs

     

    I don't think you need to use the concat expression since the if expression is placed inline after a string.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hmm.. But the syntax for contains is:

    contains('<collection>', '<value>')

     And the name of the collection/array is 'BrandlarmVCCAtt' and the string to search for is 'SATS', so shouldn't it then be like: 

    if(contains('BrandlarmVCCAtt', 'SATS'), 'nicki.vike@sats.se', '')
  • joelzehring Profile Picture
    208 on at

    Thanks for that clarification... If "BrandlarmVCCAtt" is the name of a variable in your flow, then the syntax would be: 

    if(contains(variables('BrandlarmVCCAtt'), 'SATS'), 'nicki.vike@sats.se', '')

     

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 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard