cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jvdlinden
Kudo Collector
Kudo Collector

Logic App flow sending duplicate email when it should only send one

Hi all,

 

I seem to have a similar issue as Tbruns was facing here: https://powerusers.microsoft.com/t5/Building-Flows/Flow-Sending-Multiple-Emails-when-only-one-should...

The thing is my flow is slightly different. I am not using a for each / apply to each function in my workflow.

 

Case:

A user creates a list item for expense reporting purposes.

The user should submit the expense within a month. If he/she doesn't, this workflow sends a reminder per email.

 

Expected behavior:

The workflow should only send one (1) reminder email message after 28 days after the list item had been created.

 

Actual behavior:

The user is receiving the correct email message, but twice instead of once.

 

Workflow configuration:

 

This is my trigger:

trigger and condition.png

 

If the list item status equals "New" and ReminderSent equals "false", proceed.

 

Next, I am composing the date the reminder should be sent:

If-true.png

Compose function contains the following expression: 

addDays(triggerBody()?['Created'],31)

 

Delay until function contains the following expression:

Outputs('Compose')

 

Next, I am performing a Get item function, because the item might have been modified in the meantime.

 

Next, I am making sure to proceed only when the Status is still New and ReminderSent is still false:

condition2.png

 

Last step is to send that actual email message:

email.png

 

The result is me receiving two email messages:

 

I'm hoping someone could help me identify the cause of this issue.

 

16 REPLIES 16
yashag2255
Dual Super User II
Dual Super User II

Hey @jvdlinden 

 

Can you confirm that the condition 2 in the logic app is under the Yes branch of the condition 1 under the Get Item action? And the send an email action is under the Yes branch of the condition 2 under the update item action? 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 thanks a lot for helping out.

Yes, I can confirm both questions.

 

Please find a screenshot of the entire workflow below:

entire logic app.png

Hey @jvdlinden 

 

Can you share details on the last Create Item action in the flow? Maybe that create item action is re-triggering the flow and thus sending two email messages. 

 

Can you check and confirm that?

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 thanks again for your reply, I really appreciate your help.

 

Please find a screenshot of the last Create item function below:

create item.png

 

As you may notice, this action is creating a list item in a different SharePoint list, within the same SharePoint-site.

The reason why I had created this action is because Logic Apps currently do not support the PowerApps Notification action. A Microsoft Flow workflow has been configured to this separate list, and sends a push notification to the respective user once a list item has been created in this separate list.

A noteworthy fact is that this action is also being performed twice! So not only the Email action, but also this Create Item action.

 

Hope this makes sense 🙂

Hey @jvdlinden 

 

Can you check the run history of the Logic App and see if it is getting triggered twice based on the same item?

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 ,

 

I had created this list item at October 3rd 2019, 8:37 AM (Amsterdam time zone).

You may have noticed that this workflow only runs once a day.

This means that the item is being picked up at October 4 (00:28).

 

I have filtered the Runs History view to only show runs started earlier than October 5, time: 00:00.

Notice that there is only one run. The second run in this view does not match the first condition as the status value is "Paid out" and not "New".

 

Run history.png

Anyone an idea? 🙂

Hey @jvdlinden 

 

If you closely look at the run history, the logic app is getting triggered twice for a particular instance. First run takes a lot more time and the second one just a few seconds (basically duplicating the stuff)

 

I would recommend to re-visit the logic build one more time and see if there has been some gap or issue over there. It would help to check if there is any other flow or app or source that is creating any items that might interfere with this one. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 thanks for your reply.

 

When I look to that second run. I notice that it is terminating at the first condition.

Reason why is because the item appears to be completely empty:

 

Second-workflow.pngTrigger-empty.png

 

Looks like this run does not relate to the same item.

 

Bump 😊

Another update today.

Today I received another reminder through Logic Apps, and today I received even 5 email messages!

 

Outlook-duplicated-email.png

 

I really have no clue where this is coming from, hoping someone is able to help me out.

 

Thanks!

AdamD
Helper III
Helper III

I'm experiencing exactly the same issue with one of my flows, which also operates on a delay and uses a second get-item to verify that items have not changed during the time that elapsed and a condition to proceed. I never see duplicate runs of the flow, but users report getting two-four duplicate emails.

Did you ever find a solution for this @jvdlinden ?

Hi @AdamD ,

Can you share me some high level details of your flow? Then I can compare it with my flow.

In the end I got it fixed. I will look into this.

Certainly! The flow is initiated by a Power Apps trigger. From there it collects the ID of the sharepoint list item, which I use to perform the Get Item from the sharepoint list. I then initialize a variable based off the Due Date of the item.
ScreenshotFlow1.png

I then delay the flow until 8 hours before the Due Date. After that delay, I run a get item again, I use conditions to advance based on whether the due date is still the same and if the item status is not set to "complete".

ScreenshotFlow2.png
If the conditions are met, an email is sent out and the flow terminates, if they are not, the flow just terminates.

ScreenshotFlow3.png


One thing I'm wondering is if the Flow is somehow running against all versions of the item, since item versioning is enabled. Let me know if you need anything else. Thank you!

Hi @AdamD ,

Do you see this flow only running once? But it is sending multiple email messages?

I assume i.e. a button is connected to your Power Automate trigger here.

 

By the way:

Not sure if you are aware of this feature, but there is already an action card available that lets you check for changes on a specific column. This may be useful.

Get-changes.png

It returns 'true' or 'false' for each column depending if it has been changed since the specified version or timestamp.

AdamD
Helper III
Helper III

Correct, flow runs only once, but multiple emails get sent out. The trigger logic is embedded in the form's OnSave property. When the date field is changed, a variable is set to true, if that variable is set to true when the user saves the form, the flow is triggered. 

Thanks for that tip for items in Flow! I think I could probably use it to get around having a trigger in the forms at all.

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (62,035)