cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted

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
Highlighted
Resolver II
Resolver II

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!

Highlighted

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.

Highlighted

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.

 

Highlighted

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

Highlighted

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

1.png

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,887)