cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kenneth0596
Advocate II
Advocate II

Send an email depending on multiple choice question

Hi everyone,

 

I have a multiple choice question (which department should be included? User can select multiple answers) and depending on the response to that question, the flow will send out email to corresponding department lead. For instance, a user select Finance and HR then the email will go to Finance director and HR director. Any help would be greatly appreciated, thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @kenneth0596,

 

You can follow these steps to create a Flow a bit complex, but I will explain it as clear as possible:

Step 1: We need to get the value of the choice answer from the MS Forms by using the Get response details action;

Step 2: After we get the response detail, we need to process the response into an array. The choice answer could not convert into an array directly because of it will be String format return, so we need to remove these characters: ", \, [, ] by using the replace() function, after that, use the split() function to convert it into array and initialize a variable named Choice.

Step 3: Initialize a String variable named EmailAddress to store email address according to the Department name (Choice there is) in the next steps.

Annotation 2019-11-19 173451.png

 Step 4: Loop through the Choice array, to find the corresponding email address. Get items from the list of Department, then filter array - if Department is equal to the current item of the Choice array. (On the left side of condition, the Department should be dynamic content, department name or title). After filter, append the corresponding address into the EmailAddress variable.Annotation 2019-11-19 174807.png

 After loop, you can get the variable with EmailAddress of these departments, then it can be used in to field in the send email.Annotation 2019-11-19 175423.png

 

Best Regards,
Community Support Team _ Lin Tu
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

4 REPLIES 4
v-litu-msft
Community Support
Community Support

Hi @kenneth0596,

 

I assume the data in choice should be the name of the department, what is the connection between the department's email address and the department's name?

If a user selects multiple departments, do you want to send multiple same emails to multiple departments or send one email to multiple departments and put their addresses in the CC?

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

Hi Lin Tu,

The data in choice is the name of department. I have another SharePoint which contains all department related information, name, email etc. Essentially I want to use something similar to vlookup where department equals xxx then grab information from department SharePoint.

I want to send one email to multiple departments.

Hi @kenneth0596,

 

You can follow these steps to create a Flow a bit complex, but I will explain it as clear as possible:

Step 1: We need to get the value of the choice answer from the MS Forms by using the Get response details action;

Step 2: After we get the response detail, we need to process the response into an array. The choice answer could not convert into an array directly because of it will be String format return, so we need to remove these characters: ", \, [, ] by using the replace() function, after that, use the split() function to convert it into array and initialize a variable named Choice.

Step 3: Initialize a String variable named EmailAddress to store email address according to the Department name (Choice there is) in the next steps.

Annotation 2019-11-19 173451.png

 Step 4: Loop through the Choice array, to find the corresponding email address. Get items from the list of Department, then filter array - if Department is equal to the current item of the Choice array. (On the left side of condition, the Department should be dynamic content, department name or title). After filter, append the corresponding address into the EmailAddress variable.Annotation 2019-11-19 174807.png

 After loop, you can get the variable with EmailAddress of these departments, then it can be used in to field in the send email.Annotation 2019-11-19 175423.png

 

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

 

Hello, This is exactly what I am trying to replicate as well. However, I got lost in the compose variable step. How would I determine the expression needed to capture this field from my Microsoft Form responses? 

Also, would the looping choice array show up as something that is available afterwards? I know sometimes those types of fields just fall into place base on what you enter. Or do those following variable steps need to be created independently?

 

Thank you!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,459)