cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dhinesh28R
Post Prodigy
Post Prodigy

Triggered email multiple times in Flow

Hi,

In my app i need to triggered email when a sharepoint list item getting modified.

 

My list is like following,

 

Before Updating:

Candidatecandidate email1stlevelstatus1stlevelmanager2ndlevelstatus2ndlevelmanager3rdlevelstatus3rdlevelmanager
Dhineshuser@demo.com Dhinesh User1 User2

 

After Updating:

Candidatecandidate email1stlevelstatus1stlevelmanager2ndlevelstatus2ndlevelmanager3rdlevelstatus3rdlevelmanager
Dhineshuser@demo.comYesDhinesh User1 User2

 

This is my scenario.

When 1stlevelStatus or 2ndLevelstatus or 3rdlevelstatus getting updated  i need to send an emaill to candidate, concern manager, 3rdlevelmanager and O365 group members.

 

My Flow is following,

flow email.JPG

 

Here i need to send email for candidate , concern manager(1stlevelmanager), 3rdlevelmanager and O365 Group members (3 members are in O365 group).

 

Now what my problem is am getting email 3 times.

Why its happening? 

And How to solve this issue?

 

Thanks,

Dhinesh.

1 ACCEPTED SOLUTION

Accepted Solutions
poweractivate
Super User
Super User

@Dhinesh28R 

The reason this happens is because in the Yes branch of the Condition,  although you might be correctly use an Apply to Each to iterate over all of the Group members from the "List Group Members" earlier in the Flow, you are not using the dynamic content of the Email address of List Group Members in the Email To field of the Send an Email action. Instead, you are only using the dynamic content of the Email Address of the SharePoint List Item that was modified (i.e. EmailId). So you are using the same value in each iteration of the Apply to Each.

 

Also, besides EmailID you are also using an additional value, 1stLevelEmail in Send an Email Action- are you sure this is even an e-mail address? Even if it is, this is similar problem to the above - the 1stlevelEmail will receive the same e-mail multiple times because this Send an Email Action is in the Apply to Each insteadof outside it.

 


Here i need to send email for candidate , concern manager(1stlevelmanager), 3rdlevelmanager and O365 Group members (3 members are in O365 group).

 


It looks like in the Apply to Each you might be trying to do this part:

O365 Group members (3 members are in O365 group)

So for that, you should only do that pat and use the Dynamic Content.

Then you can copy to My Clipboard and Paste the Send an Email Action, and send similar email from outside Apply to Each to the values of SharePoint List Item columns from the Trigger ( I will presume for now these are e-mail addresses for simplicity - if not, you may need to use something like Office 365 Search Users to get the e-mail address first ) .

 

Let's suppose you do not like the above idea much because it would require to maintain two almost identical Action blocks, and suppose you want to use only one Send an Email Action Block. It is a little bit more setup, but it is possible and it may be worth it for you - here's how you would do it with only one Send an Email Action Block but sending the same e-mail once to all the people you want correctly:

 

1. Initialize a Variable of type String as very first step of the Flow after the Trigger.

2. Take the Send an Email Action Block out of the Apply to Each and move it outside (but leave it in the Yes branch of the Condition). 

3. In the Yes Branch, above the Send an Email Action, and inside an Apply to Each, use an Append to Variable Action, and then use the expression something like 

 

concat(whateverEmailFromDynamicContent,';')

 

4. In the Action block "Send an Email" from Step 2 which should now be appearing below the Apply to Each, place  the Variable's value (from Dynamic content) in the "To" field. 

5. Since the Variable will be a string of three email addresses separated by semicolon and with a semicolon at end, place your dynamic content in the To field to the right of the one you just placed in #4 above, concern manager(1stlevelmanager) Dynamic Content (which I presume for now is able to be used directly from the SharePoint Item Modified Trigger for now for simplicity) - and then in the dynamic content, type in a single semicolon as well directly to the right of that Dynamic Content.

6. To the right of what you just placed in #5, now place the Dynamic Content for 3rdlevelmanager. Since this is the last item, typing a semicolon to the right may not be necessary.

7. (Optional) If you have any more e-mail addresses you want to add after this, make sure to separate them by semicolons.

8. The result is that inside Apply to Each, a series of 3 email addresses are concatenated into a single String first, to be used in a single Send an Email action directly after and outside the Apply to Each to send a single e-mail to multiple people. In addition to this, besides the 3 people in the group, Steps #5 and #6 above make sure the e-mail also gets sent to two additional people, concern manager(1stlevelmanager) and 3rdlevelmanager (for simplicity, I am presuming that these two people's e-mail addresses exist inside the columns accessible from the trigger).

 

 

View solution in original post

1 REPLY 1
poweractivate
Super User
Super User

@Dhinesh28R 

The reason this happens is because in the Yes branch of the Condition,  although you might be correctly use an Apply to Each to iterate over all of the Group members from the "List Group Members" earlier in the Flow, you are not using the dynamic content of the Email address of List Group Members in the Email To field of the Send an Email action. Instead, you are only using the dynamic content of the Email Address of the SharePoint List Item that was modified (i.e. EmailId). So you are using the same value in each iteration of the Apply to Each.

 

Also, besides EmailID you are also using an additional value, 1stLevelEmail in Send an Email Action- are you sure this is even an e-mail address? Even if it is, this is similar problem to the above - the 1stlevelEmail will receive the same e-mail multiple times because this Send an Email Action is in the Apply to Each insteadof outside it.

 


Here i need to send email for candidate , concern manager(1stlevelmanager), 3rdlevelmanager and O365 Group members (3 members are in O365 group).

 


It looks like in the Apply to Each you might be trying to do this part:

O365 Group members (3 members are in O365 group)

So for that, you should only do that pat and use the Dynamic Content.

Then you can copy to My Clipboard and Paste the Send an Email Action, and send similar email from outside Apply to Each to the values of SharePoint List Item columns from the Trigger ( I will presume for now these are e-mail addresses for simplicity - if not, you may need to use something like Office 365 Search Users to get the e-mail address first ) .

 

Let's suppose you do not like the above idea much because it would require to maintain two almost identical Action blocks, and suppose you want to use only one Send an Email Action Block. It is a little bit more setup, but it is possible and it may be worth it for you - here's how you would do it with only one Send an Email Action Block but sending the same e-mail once to all the people you want correctly:

 

1. Initialize a Variable of type String as very first step of the Flow after the Trigger.

2. Take the Send an Email Action Block out of the Apply to Each and move it outside (but leave it in the Yes branch of the Condition). 

3. In the Yes Branch, above the Send an Email Action, and inside an Apply to Each, use an Append to Variable Action, and then use the expression something like 

 

concat(whateverEmailFromDynamicContent,';')

 

4. In the Action block "Send an Email" from Step 2 which should now be appearing below the Apply to Each, place  the Variable's value (from Dynamic content) in the "To" field. 

5. Since the Variable will be a string of three email addresses separated by semicolon and with a semicolon at end, place your dynamic content in the To field to the right of the one you just placed in #4 above, concern manager(1stlevelmanager) Dynamic Content (which I presume for now is able to be used directly from the SharePoint Item Modified Trigger for now for simplicity) - and then in the dynamic content, type in a single semicolon as well directly to the right of that Dynamic Content.

6. To the right of what you just placed in #5, now place the Dynamic Content for 3rdlevelmanager. Since this is the last item, typing a semicolon to the right may not be necessary.

7. (Optional) If you have any more e-mail addresses you want to add after this, make sure to separate them by semicolons.

8. The result is that inside Apply to Each, a series of 3 email addresses are concatenated into a single String first, to be used in a single Send an Email action directly after and outside the Apply to Each to send a single e-mail to multiple people. In addition to this, besides the 3 people in the group, Steps #5 and #6 above make sure the e-mail also gets sent to two additional people, concern manager(1stlevelmanager) and 3rdlevelmanager (for simplicity, I am presuming that these two people's e-mail addresses exist inside the columns accessible from the trigger).

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

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 Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,183)