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

Having Issues Sending Emails Based on People/Groups From List

I set up a flow to email people when a list item approaches its due date, that part of the flow works perfectly.  The issue is when I try to send the email. 

 

If I put a static email in the "To" field the email(s) are sent as they should. 

 

If I try to pull the email from the list itself (people/groups), Flow puts in a Apply to each loop, and the end results is multiple emails are sent.  

 

I've tried some of the solutions out there to try and get around this (the apply to each loop), but haven't been successful as yet.

 

Below are pics of the flow, and the end result.

 

Any help would be appreciated.

11.png     12.png

1 ACCEPTED SOLUTION

Accepted Solutions
Piper
Level 8

Re: Having Issues Sending Emails Based on People/Groups From List

You need to initialize the variable before entering the loop and before any conditionals. I tend to put any variables right after the trigger. Give it a name like Email Recipients and type as String. Then in the loop append to that variable by selecting it's name. Be sure to add a semicolon (or perhaps a comma) after each email address you select.

That should the trick.

View solution in original post

5 REPLIES 5
Piper
Level 8

Re: Having Issues Sending Emails Based on People/Groups From List

If you move the send email below (outside) the Apply to Each and put a Append to Variable (string) inside the loop with the email address and a semicolon you should you will be able to send a single email. Then use the variable in the To field.

 

I hope that helps!

FayeJasman
Level: Powered On

Re: Having Issues Sending Emails Based on People/Groups From List

More steps to it than that?  The append to string variable is looking for a Name, and from my limitied Flow knowledge says its looking for maybe an initialize variable? It won't let me do that inside that loop, I get this error, "The operation 'Initialize variable' can only be used at top level."

 

Should that process maye be a parrelll branch, then come down to the condition step?

 

Sorry, kind of new to the more complicated Flows.

FayeJasman
Level: Powered On

Re: Having Issues Sending Emails Based on People/Groups From List

I tried the paralell branch, and then the condition, but it adds the address mulitple times (but works).  I'm going to have to rethink this, I must be doing something wrong somewhere.

 

Piper
Level 8

Re: Having Issues Sending Emails Based on People/Groups From List

You need to initialize the variable before entering the loop and before any conditionals. I tend to put any variables right after the trigger. Give it a name like Email Recipients and type as String. Then in the loop append to that variable by selecting it's name. Be sure to add a semicolon (or perhaps a comma) after each email address you select.

That should the trick.

View solution in original post

FayeJasman
Level: Powered On

Re: Having Issues Sending Emails Based on People/Groups From List

Thanks for the help.  I did take a simpler approach though, below is the working workflow

1.png

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

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 Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,333)