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

Send email based on form response (First Name, Surname)

I'm trying to work out a way for an email address to be picked up based on a form response of someones name selected.

 

E.g.

My form asks: Select a Consultant

The list contains about 15 different consultant names (First Name, Last Name), all within our organisation.

Lets say the consultant "Bob Newbie" was selected.

The form is submitted.

 

What I Need:

Flow receives the form responses.

Detects the name "Bob Newbie".

Matches that name with his associated email address ("Bob Newbie" equals "bob.newbie@company.com.au")

Send email notification to "bob.newbie@company.com.au".

 

I want the response of this submission to go to the consultant based on what name was selected in the field.

 

Is this possible?

 

I've played with "Detect User ID" and it didn't work, I can see this article: https://powerusers.microsoft.com/t5/Building-Flows/Send-emails-to-different-people-based-on-a-form-r... will probably solve the issue however I have 15 different conditions to add... I don't know that that would work?

1 ACCEPTED SOLUTION

Accepted Solutions
RobElliott
Super User
Super User

Hi @dm_elementwa, yes it very possible and quite easy. There are 2 ways, either with switches or parallel branching. As the condition is static, i.e which consultant has been selected, I would use a Switch in this case. It makes the overall flow slightly less wide. I think you can have 25 cases so your dropdown of 15 consultants will be no problem. The images below show you both the switch case and parallel branching methods.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

1 - Form dropdown1 - Form dropdown2 - Switch case2 - Switch case3 - Parallel branching3 - Parallel branching

View solution in original post

7 REPLIES 7
RobElliott
Super User
Super User

Hi @dm_elementwa, yes it very possible and quite easy. There are 2 ways, either with switches or parallel branching. As the condition is static, i.e which consultant has been selected, I would use a Switch in this case. It makes the overall flow slightly less wide. I think you can have 25 cases so your dropdown of 15 consultants will be no problem. The images below show you both the switch case and parallel branching methods.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

1 - Form dropdown1 - Form dropdown2 - Switch case2 - Switch case3 - Parallel branching3 - Parallel branching

View solution in original post

Champion! Thank you! This works perfectly 😄 

I am attempting to recreate this same exact thing but I am using a group form and have to put in a form ID. I am stuck on the next step. There is no ouput to select under "apply to each" it's just blank. Help? 

I actually got it to finally give me options for it but there are three possible list of responses.

 

List of response notifications Item

List of response notifications resourceData

List of response notifications Response ID

 

Which do I choose? None of them have really worked for me so far.

 

Also, which of the three "list of responses" should I use for the next step under Get Response Details? 

 

And now, I can't get dynamic content to appear again under apply to each... UGH!!

This is the error I'm getting: Error Action 'Apply_to_each' failed Error Details The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['resourceData']?['responseId']' is of type 'Integer'. The result must be a valid array.
Anonymous
Not applicable

I am receiving the same error 

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['resourceData']?['responseId']' is of type 'Integer'. The result must be a valid array.

 

How do we solve this?

1ouis
Frequent Visitor

Hello 👋 

 

Nice response @RobElliott 👍 

Is there another way to do this if there are over 30 options in the Form?

Perhaps build an array and then send the relevant according to the form choice?
I tried a Switch but hit an error when I got to 25 switches - not very scalable either 😕 
Thanks!

Helpful resources

Announcements
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.

Top Solution Authors
Users online (3,117)