cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeNJ00
Helper I
Helper I

SharePoint List Flow Emailing Multiple Users

Hi I have a Flow I built using a SharePoint list.  I want it to email users based on certain criteria I have setup.  Everything is working as it should, until I add in a SharePoint column that allows multiple users to be picked.  Once I add it in the CC field, the Send an Email function gets automatically put into a section "Apply to each" and then when the flow runs, it not only emails the users in the CC box one at a time, but also sends them duplicate emails based on how many people are in that Additional Persons column.  Is there a way to add that field into the CC, and have it send to the users once?  FlowApplyToEach.PNGFlowNext.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @MikeNJ00 ,

 

Please try to refer to the following image to configure your Flow.

49.PNG

Details of Apply to each:

51.PNG

Initialize string variable and append person email to a string variable.

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
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

10 REPLIES 10
Pstork1
Dual Super User
Dual Super User

Initialize a String variable and then do a ForEach loop where you take the collection of users and append each email to the variable with a ';' semicolon after it.  Then use that variable in the CC.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
RezaDorrani
Dual Super User II
Dual Super User II

Hi @MikeNJ00 

 
First remove send email action fronm the for loop
Above the for loop
create a variable of type array and initialize it to []
 
Next within the for loop, do append to array variable and append the value of the addtional person email field
 
after for loop completes you will get an array of email addresses
next to send email 
 
use expression
join(variables('arrayname'),';')   - this will create semi colon seperated addresses of the emails
so you can use this in the email action (email action after the for loop)
 
 

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Thanks for your reply.  However, to let you know I'm a basic user and don't understand much of what you suggested.  From my screen shot here can you tell me where I should add the append to string variable and how to setup what you are suggesting, please?Loop.PNG


@RezaDorrani wrote:

Hi @MikeNJ00 

 
First remove send email action fronm the for loop
Above the for loop
create a variable of type array and initialize it to []
 
Next within the for loop, do append to array variable and append the value of the addtional person email field
 
after for loop completes you will get an array of email addresses
next to send email 
 
use expression
join(variables('arrayname'),';')   - this will create semi colon seperated addresses of the emails
so you can use this in the email action (email action after the for loop)
 
 

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.


where is the for loop?


@RezaDorrani wrote:

@RezaDorrani wrote:

Hi @MikeNJ00 

 
First remove send email action fronm the for loop
Above the for loop
create a variable of type array and initialize it to []
 
Next within the for loop, do append to array variable and append the value of the addtional person email field
 
after for loop completes you will get an array of email addresses
next to send email 
 
use expression
join(variables('arrayname'),';')   - this will create semi colon seperated addresses of the emails
so you can use this in the email action (email action after the for loop)
 
 

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.


where is the for loop?


is the for loop the "apply to each" if so I removed it since I have users testing the form and didn't want them getting bombarded with emails until I figure out how to fix this

 

Hi @MikeNJ00 ,

 

Please try to refer to the following image to configure your Flow.

49.PNG

Details of Apply to each:

51.PNG

Initialize string variable and append person email to a string variable.

Hope it helps.

 

Best Regards,

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

Thank you for your response @v-bacao-msft can you take a look at what I have setup?  I'm getting an error when testing

Copy1.pngCopy2.jpg

@v-bacao-msft nevermind, I found my mistake.  That helps!  Thanks

Im trying to do something similar but seem to be getting an error. foreach.PNG

 

foreach2.PNG

I'm having a similar error and have been trying to get this to work for the past several hours after viewing several different sets of instructions I've found.   I've tried adding the variable for the array as well as the actual dynamic column information and everything keeps coming back with an error.

 

it keeps giving me the following error, however i used array so I've no idea what I've done wrong.  

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@{triggerBody()?['OData__x0063_c2']};' is of type 'String'. The result must be a valid array.

 

I will add that I am still pretty new to this and it's the first time I'm trying. Can someone help me figure out what I'm doing wrong here?  I'd like 1 single email to go out with everyone they entered in to the "CC" people picker where they can add more than 1 person.

 

Thanks in advance!

 

multiemails.jpg

 

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,783)