cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
meddlema
Helper I
Helper I

Sending to different emails address based on drop down answer

I am building a simple form that will be emailed to different groups based on the answer of the Region drop down.   The form will not be saved to SP or a collection.  It is going to just be emailed. 

 

Ex. If the user selects Corporate or Southwest the corporate human resources is emailed with a CC to another group (Corphremail@domain.com  cc: john.doe@domain.com)

If the user selects Southeast the southeast human resources group is emailed with a CC to yet another person(that differs from above) (SEhremail@domain.com cc: jane.doe@domain.com

 

I have a power apps flow built

Email Flow.PNG

 

Here is a shot of the form: 

PA Title Change.PNG

 

I am not sure how to build the code for the submit button.    Any help is appreciated!

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @meddlema ,

Based on the formula you provided, I think there is something wrong with it. You have missed ")" close operator for your two Switch formula.

 

Please consider modify your formula as below:

TitleChangeEmailFlow.Run(
    HtmlText1.HtmlText,
    "Title Change",
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","CorpHremail@domain.com",
        "Southwest","CorpHremail@domain.com",
        "Southeast","SEhremail@domain.com"
    ),                    // do not miss ')' close operator here
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","johndoe@domain.com",
        "Southwest","johndoe@domain.com",
        "Southeast","janedoe@domain.com",
    )
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

5 REPLIES 5
mdevaney
Super User
Super User

@meddlema 
I only see 3 variables showing in your Flow.  I assume there is a 4th variable for CC hidden in the advanced settings.

 

TitleChangeEmailFlow.Run(
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","CorpHremail@domain.com",
        "Southwest","CorpHremail@domain.com",
        "Southeast","SEhremail@domain.com",
    "My Subject Line",
    "My email body",
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","johndoe@domain.com",
        "Southwest","johndoe@domain.com",
        "Southeast","janedoe@domain.com",
    )
)

 

Note: I am assuming the order of your variables for this function is (To,Subject,Body,CC).  Swap the order of arguments in my code if your ordering does not match.
—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Thank you for the code.   Is something missing?

 

Yes, I have 4 variables:  Body, Subject, To, and CC

 

I am receiving Unexpected Error.  Characters are used in the formula in an unexpected way

 

PIC.PNG

@meddlema
I made two syntax errors: missing a close bracket for the 1st SWITCH statement and an extra comma at the end of the 2nd SWITCH statement. See my corrections below.

 

TitleChangeEmailFlow.Run(
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","CorpHremail@domain.com",
        "Southwest","CorpHremail@domain.com",
        "Southeast","SEhremail@domain.com"
    ),  //forgot this close bracket initially
    "My Subject Line",
    "My email body",
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","johndoe@domain.com",
        "Southwest","johndoe@domain.com",
        "Southeast","janedoe@domain.com"  //removed an extra comma from here
    )
)

 

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Hi @meddlema ,

Based on the formula you provided, I think there is something wrong with it. You have missed ")" close operator for your two Switch formula.

 

Please consider modify your formula as below:

TitleChangeEmailFlow.Run(
    HtmlText1.HtmlText,
    "Title Change",
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","CorpHremail@domain.com",
        "Southwest","CorpHremail@domain.com",
        "Southeast","SEhremail@domain.com"
    ),                    // do not miss ')' close operator here
    Switch(
        DropdownRegion.Selected.Value,
        "Corporate","johndoe@domain.com",
        "Southwest","johndoe@domain.com",
        "Southeast","janedoe@domain.com",
    )
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

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

Thank you very much for the assist.  It works perfectly.   I found the parenthesis but the coma eluded me. 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,389)