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!
Solved! Go to Solution.
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.
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.
After loop, you can get the variable with EmailAddress of these departments, then it can be used in to field in the send email.
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 @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 @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.
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.
After loop, you can get the variable with EmailAddress of these departments, then it can be used in to field in the send email.
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!
User | Count |
---|---|
88 | |
37 | |
26 | |
13 | |
13 |
User | Count |
---|---|
127 | |
54 | |
37 | |
24 | |
21 |