cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MrtnM
Post Patron
Post Patron

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

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.

View solution in original post

Anonymous
Not applicable

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.

View solution in original post

Anonymous
Not applicable

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

View solution in original post

18 REPLIES 18
v-yamao-msft
Community Support
Community Support

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.

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.

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.

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

Anonymous
Not applicable

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.

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.

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
Helper II
Helper II

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

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

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

Hi @Anonymous

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

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

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

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

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 🙂 Everything works just perfectly, and I also have learned a lot about how to use variables.

@MrtnM  

Here is my suggestion...

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

Good job @Anonymous 

 Heart

 


@Anonymous 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.


Okay I get the part of storing all in an array but what if you want to create an array for the TO part & one for the CC part.

How can you then pull both outputs into 1 email ...

cander23314
Regular Visitor

Good afternoon,

 

I am trying to create an email notification to multiple people based on a "people/group" column in SharePoint. Could you kindly share how the workflow should look like?  The "people/group" column in the list is labeled as "NotificationParties. "  This column will change based on the item.  I sincerely appreciate your help.  

 

cander23314_0-1657315298527.png

 

Helpful resources

Announcements

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (4,030)