I cannot seem to find a straight answer to the following.
I have a form with a question:
"Who would you like to send these responses to? "
The options are (this is simplified, there are actually dozens of email options, so conditionals wont do):
Bob
Sally
Joe
(multiple answers are allowed)
These 3 people have the following emails:
(The emails do not appear on the form, I want them hidden from the user)
I have compiled a json as follows, but do not understand how to take the choices the user picked, and put them into the TO field of an email.
[
{"bob": "bob@contoso.com",
"sally": "sally@contoso.com",
"joe": "joe@contoso.com"
}
]
So if Bob, and Sally were chosen, then "Bob@contoso.com;sally@contoso.com" should be the appended string which will then go into the TO: field of an email.
Doing this in code is trivial, but I can't seem to figure this out with Power Automate.
Thank you!
Jose
also, for me, the Get Response Details step auto creates an apply to each loop, so mine looks different than yours.
@v-mengmli-msft
IRT the replace string, That makes sense, ty.
as for the emails, I have a list of users and distribution groups in a JSON file. The user selects from a multichoice question on the form, and there is conditional
logic in the form based on certain answers that determines who gets an email of form responses.
Edit: Unfortunately, that flow did not work. The search users step returns nothing see below, and it's probably because the names in Azure don't quite match the response answers.
There must be an easier way to take the name and email value pairs from a json or from a csv and compare them to the multi-select value array. The split worked, though I am not sure how to expand it in the case that I add more names/emails to the question on the form.
also I get this when I use a compose to gather the appended "Email" array:
thank you so much for your help!
Hi @josedelara ,
I didn't ask clearly. I thought at first that the suffix of the emails was the same. How do you get the User's emails? 'Search for Users' action?
If so, I recommend you move it in 'Apply to each' to get each user's email according to current item's value.
Something just like this:
first(outputs('Search_for_users_(V2)')?['body/value'])?['Mail']
As for why this formula is used:
split(replace(replace(replace(replace(QuestionDynamicContent,'[',''),']',''),',',';'),'"',''),';')
It is because the output of the multi-select value is actually in this string format: ["Option1","Option2"].
So, if we want to get the email of each option, we need to first convert the output into an array.
This is why I don't modify the array you currently get, because all emails are in an item of an array, rather than each email being an item of the array. This cannot be used directly in Join action.
Best regards,
Rimmon
split(replace(replace(replace(replace(QuestionDynamicContent,'[',''),']',''),',',';'),'"',''),';')
This string is very difficult to read, can you break down the syntax? Why so many nested parentheses?
I should have clarified. The names do not match the email prefixes, so a simple join won't work. (that would be too easy :))
So it would be more like
Bob- robertjones@contoso.com
Sally - sallyrsmith@contoso.com
Joe - josephwbrownjr@contoso.com
Hi @josedelara ,
I suggest you convert the result of this question into an array and then use a join action to convert the array into this format: Bob@contoso.com;Sally@contoso.com.
Here is my test for your reference:
split(replace(replace(replace(replace(QuestionDynamicContent,'[',''),']',''),',',';'),'"',''),';')
concat(item(),'@contoso.com')
The result of my test:
Best regards,
Rimmon
Michael E. Gernaey
179
Super User 2025 Season 1
David_MA
161
Super User 2025 Season 1
stampcoin
143