cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dovetail
Helper II
Helper II

Flow is sending multiple emails

Hi there,

 

I would appreciate it if anybody can help.

I have a flow that sends an email to HR whenever a leave has been approved, and then updating the sharepoint list.  It is based on the following condition:

Dovetail_0-1600250501316.png

If status is Approved and Mail_Sent_To_HR is no, then send an email to HR with leave details and update the Mail_Sent_To_HR to Yes.

Dovetail_1-1600250710798.png

 

1. Employee request leave using Leave request app in PowerApps. (Status of leave is pending In sharepoint list)

2. Manager approves the request.( Status changes to Approved in sharepoint list)

3. The flow is triggered and an email is sent to HR and the Mail_Sent_To_HR column gets updated as well.

 

My problem is that the flow sends many mails to HR. It sends mails of requests that were approved in the past instead of only the one that was just approved. 
Every time a manager approves a leave requests. HR gets emails of all the requests that are approved.

 

I would like it to only send the only that was just approved. 

 

How do i achieve this?

 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Dovetail 

 

The flow trigger is providing you the SharePoint list item you need. I do not see a reason for using "Get Items" - It will bring all the SharePoint list items into the flow. 

 

You can remove the action "Get Items" and refer the fields from tigger action "When an item is created or modified" within your Email and Update item. 

 

Also, you need to modify the Trigger condition to start the flow only for the items whose Status is Active. Otherwise, flow will run for all changes in the list.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

View solution in original post

5 REPLIES 5
rsaikrishna
Super User
Super User

@Dovetail 

 

Did you check the Flow Runs? In the flow run, you can see the SharePoint list items Input and output values. It helps you to see if the input values are as expected or not. 

 

When Approved = Yes and SentEmail =No, is the list item getting updated to set the flag to YES or not. You can check this in the flow run. Also, what triggers the flow? Can you provide screen shot of complete flow?

 

Is versioning turned on in the SharePoint list? If so, you can check the item's versions to see how many times the item was updated and what was updated. 

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

 

Hi @rsaikrishna 

this is the snippets of the flow.

 

Dovetail_0-1600253961349.png

Dovetail_1-1600254027457.png

Versioning was not turned on
I just turned it on.

 

@Dovetail 

 

The flow trigger is providing you the SharePoint list item you need. I do not see a reason for using "Get Items" - It will bring all the SharePoint list items into the flow. 

 

You can remove the action "Get Items" and refer the fields from tigger action "When an item is created or modified" within your Email and Update item. 

 

Also, you need to modify the Trigger condition to start the flow only for the items whose Status is Active. Otherwise, flow will run for all changes in the list.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

Hi there @rsaikrishna 

 

I did as requested and removed the "Get Items" Action. 

this is how the flow looks now.

Dovetail_0-1600330421713.png

Dovetail_1-1600330452787.png

I am however struggling to set the condition properly. The following error is thrown:

Dovetail_2-1600330508938.png

 

 

 

Its just a warning because if you update the item, the item enters the flow again, but there is no problem because in the next flow  Email Sent = YES and the item is no longer updated and dont start again.

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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!

Top Solution Authors
Top Kudoed Authors
Users online (3,569)