cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MrtnM
Level: Powered On

send e-mail to multiple users with dynamic content

Hi,

I've created a simple Flow to send e-mails when a Sharepoint object is created.

The e-mail is sent to the users mentined in a "Persons or group" Sharepoint list field.

If there are more than one user in the list field, I want to show that in the text of the e-mail.

So I inserted the dynamic content for the list field - but the only thing that shows is the name of the user that the e-mail is sent to.

 

Example:

  • User A and B are selected in the corresponding Sharepoint list field.
  • E-mails are correctly sent by the Flow to both user A and B.
  • But in the e-mail, for user A it looks like the e-mail is only sent to user A, and corresponding for user B.

 

Namnlöst-2.jpg

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: send e-mail to multiple users with dynamic content

Hi MrtnM,

 

Thanks for clarification.


I got that you have enabled “Allow multiple selections” for the optional Person or Group column.


When testing again with it, I am getting the same issue with you. The email can be sent to both recipients, but in the email body, it only shows the name of the recipient. While you want to show both the two names in the email body.


It might be a default behavior. As you can see, when you select the multiple selections enabled dynamic content “Person or Group” column, an Apply to each will be added automatically. Then flow will consider each person as a recipient and send an email to the email address.

3.PNG

 

A workaround for this issue, please try to add several more person or group columns for each optional person but not enable the multiple selections, say option1, option2, etc. Then in the Body field, you could select the dynamic content for corresponding person. By this way, you could not only send email to the recipients, but also display their name on the email body.

 

Please have a try with it.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anja
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Hallo,

I had the same issue like you. I figured out how to go through. 

 

With variables you can join all mail adresses in one string. And send one mail to several personen (contained in one SP person or group field).

1. Step: Initialize a vaiable with the type array.

2. Step: Append the person or group field to the array variable. Flow autmomaticallay makes an apply to each.

3. Step: Join the array variable with the sign ; .

So you have all mail adresses in one data field. At least you can sent an e-mail.

 

Flow Mail an Mehrpersonenfeld.PNG

 

I hope this yould help other people.

Anonymous
Not applicable

Re: send e-mail to multiple users with dynamic content

I'm not sure that I see your Join action there.

 

SendTo is my array of recipients.  Output is the result of the Join action.

 

Capture.JPG

16 REPLIES 16
Community Support Team
Community Support Team

Re: send e-mail to multiple users with dynamic content

Hi MrtnM,

 

I did some test on this issue according to your description.


In the list, there are two Person or group columns. One is “Approved By?”, the other one is “Person or Group”.


In the flow, I select the dynamic content of these two columns for To field and Body field.


When a new item is created, the flow will be triggered and an email will be sent to the two users.


As you can see, in the email body, both the two users are displayed.

3.PNG

4.PNG


Could you please try again with it?


Do you have two Person or Group type of columns for the two users?


If you are still having the issue, please feel free post back with more details about your issue.


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MrtnM
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Thank you for the reply and effort.

I do not think this solution will work for me.

My list has two Person or group columns, yes. Numer 1 is mandatory: "Person who recieved the request from customer" and number 2 is optional: "Person(s) you want to notify about the request".

The Flow runs only if there is information in column 2. If there are 2 persons mentioned in column 2, e-mail is correctly sent to both persons, but in the e-mail text the dynamic content from column 2 only shows the name of the recipient.

Unfortunately I do not see a way to apply your solution to my issue.

Community Support Team
Community Support Team

Re: send e-mail to multiple users with dynamic content

Hi MrtnM,

 

Thanks for clarification.


I got that you have enabled “Allow multiple selections” for the optional Person or Group column.


When testing again with it, I am getting the same issue with you. The email can be sent to both recipients, but in the email body, it only shows the name of the recipient. While you want to show both the two names in the email body.


It might be a default behavior. As you can see, when you select the multiple selections enabled dynamic content “Person or Group” column, an Apply to each will be added automatically. Then flow will consider each person as a recipient and send an email to the email address.

3.PNG

 

A workaround for this issue, please try to add several more person or group columns for each optional person but not enable the multiple selections, say option1, option2, etc. Then in the Body field, you could select the dynamic content for corresponding person. By this way, you could not only send email to the recipients, but also display their name on the email body.

 

Please have a try with it.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MrtnM
Level: Powered On

Re: send e-mail to multiple users with dynamic content

That workaround could do it. Thank you very much for all the help!

Anja
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Hallo,

I had the same issue like you. I figured out how to go through. 

 

With variables you can join all mail adresses in one string. And send one mail to several personen (contained in one SP person or group field).

1. Step: Initialize a vaiable with the type array.

2. Step: Append the person or group field to the array variable. Flow autmomaticallay makes an apply to each.

3. Step: Join the array variable with the sign ; .

So you have all mail adresses in one data field. At least you can sent an e-mail.

 

Flow Mail an Mehrpersonenfeld.PNG

 

I hope this yould help other people.

MrtnM
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Thanks, that looks nice! I have never used variables before, but as soon as I have the time to dig into variables I surely will give this a try.

AdityaBehl
Level: Power Up

Re: send e-mail to multiple users with dynamic content

Thanks. The Array Variable works well but how do we reset the variable especially when its running in a loop? As the variable is only initiatilized at the top everytime the loop runs it keeps adding new email ids.

 

Thanks for your feedback.

Lexnnn
Level: Powered On

Re: send e-mail to multiple users with dynamic content

I needed to send email to users only once and not repeat their email address.

This is what I have done:

if(empty(item()?['Address']),'blank',item()?['Address'])

flow contains.JPGflow contains 2.JPG

Crockerfeller
Level: Powered On

Re: send e-mail to multiple users with dynamic content

I'v tried to do this, but I am getting errors in my flow. Action 'Append to array variable' failed

 

Not sure why? 

I init an array

then for my append I am using a dynamic content object (which is my multi-user people column)  and it can't append?

Anonymous
Not applicable

Re: send e-mail to multiple users with dynamic content

Anja - perfect, thanks!  The Join is the key.

MrtnM
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Hi @Anja

at last I was to try this. However, I got stuck immediately: I get the error message that an "InitializeVariable" is not allowed to be embedded (translation?) in an "Apply to each."

 

Namnlös.png

 

Anonymous
Not applicable

Re: send e-mail to multiple users with dynamic content

@MrtnM - Initialize the variable near the beginning of your flow and leave the Value blank and then use the Set Variable Action within your Apply to each.

MrtnM
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Thanks, that got rid of the error message.

 

However, now another issue occurs: now the e-mail shows the name of only one recipient.

That is: if A and B is mentionend in the SPO list field, e-mail is sent to A and B (expected behaviour), but in both the e-mail to A and B, the name of A is shown, and with a ";" after the name.

 

Flow config

Namnlöst-2.jpg

 

 

Anonymous
Not applicable

Re: send e-mail to multiple users with dynamic content

I'm not sure that I see your Join action there.

 

SendTo is my array of recipients.  Output is the result of the Join action.

 

Capture.JPG

MrtnM
Level: Powered On

Re: send e-mail to multiple users with dynamic content

Sorry, it was a translation misunderstanding. Now I use Flow in English, so it's easier to follow the good advice from all you experts Smiley Happy Everything works just perfectly, and I also have learned a lot about how to use variables.

Highlighted
eopara
Level: Powered On

Re: send e-mail to multiple users with dynamic content

@MrtnM  

Here is my suggestion...

This should be marked as an ANSWER... Please review.

Good job @Anja 

 Heart

 


@Anja wrote:

Hallo,

I had the same issue like you. I figured out how to go through. 

 

With variables you can join all mail adresses in one string. And send one mail to several personen (contained in one SP person or group field).

1. Step: Initialize a vaiable with the type array.

2. Step: Append the person or group field to the array variable. Flow autmomaticallay makes an apply to each.

3. Step: Join the array variable with the sign ; .

So you have all mail adresses in one data field. At least you can sent an e-mail.

 

Flow Mail an Mehrpersonenfeld.PNG

 

I hope this yould help other people.


Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fourthImage

Australia Summit

Travel to Melbourne and network with thousands of peers!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 122 members 3,616 guests
Please welcome our newest community members: