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 / Dynamic email insertio...
Power Automate
Answered

Dynamic email insertion (in Flow) for Forms email notification

(0) ShareShare
ReportReport
Posted on by 5
I just built a form for our receptionist to log a sales inquiry that comes in via the phone. Once the form is completed and submitted I want an email notification of that form to go to the appropriate sales rep (we have 6 sales reps) The receptionist knows which sales rep should receive the lead based on the state the caller is based so I don't need any sort of lookup. What is I want is this. If the receptionist selects "Bob" as the sales rep on the form, I want an email with all the prospect's info sent to Bob. I created a flow to send a notification email upon form submit, I configured the email in an easy to read format but what I can't figure out is how to setup the "To:" field on the email address, I was thinking that - If "sales rep" equals "Bob" then insert "bob@xyz.com" OR if "sales rep" equals "Jane" then insert "jane@xyz.com" (etc..) I don't think that's quite the logic but that's the idea. How do I do this? I put a multi-choice field on the form with all the reps names. I was thinking that based on whatever name was selected their email address would be inserted to the "To" field on the notification email. I'm OK changing the format of the "Sales rep" field on the form to make this work. Thanks!
Categories:
I have the same question (0)
  • Verified answer
    MattWeston365 Profile Picture
    1,701 on at

    Hi @Nick3333 , you're almost there with the logic.

     

    In your Flow, rather than having multiple IFs, you could use a Switch statement.

     

    Each leg of the switch would be the name of your sales rep and you could then insert the relevant email address.

     

    E.g.

     

    Case "Bob"
    Set email address to "bob@xyz.com"

     

    Case "Jane"

    Set email address to "jane@xyz.com"

     

    Case "Matt" etc

     

    If you're sending a simliar email to each person, then if you're not doing it already you could "Initialize a variable" before the Switch control called email address. In your switch statement you "Set variable" to the relevant email address. Then after the Switch control, have your "Send an email" action, and use your email address variable as the To address. This way you only generate the email once, and you dynamically select the To address.

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @Nick3333 

    If you post ascreen shot of your Flow, we can probably provide additional help.

     

  • Verified answer
    v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi @Nick3333 ,

     

    Do you want to return corresponding email address according a selection from Forms?

     

    Please take a try with the following code, which will return a correct email address once the form is submitted.

     

    The function is:

    if(equals(body('Get_response_details')?['rf03a8402796d4108ab1ebaf6c3e26c2b'],'mabel'),'mabel@xxxxx.onmicrosoft.com',if(equals(body('Get_response_details')?['rf03a8402796d4108ab1ebaf6c3e26c2b'],'test4'),'test4@xxxxx.onmicrosoft.com','test2@xxxxx.onmicrosoft.com'))

     

    Image for your reference:

    1.PNG

     

    Best regards,

    Mabel

     

  • Nick3333 Profile Picture
    5 on at

    Matt, thanks 

     

    It took a few to understand your reply, not knowing forms/flows that well but this is exactly what I ended up doing and it works perfectly.

     

    Thanks again

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 376

#2
Valantis Profile Picture

Valantis 361

#3
David_MA Profile Picture

David_MA 294 Super User 2026 Season 1

Last 30 days Overall leaderboard