web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Ignore duplicate email...
Power Automate
Unanswered

Ignore duplicate email addresses when sending emails

(0) ShareShare
ReportReport
Posted on by

Hi I've built a flow that looks through my spreadsheet and sends 165 managers a table of their direct reports and what training they haven't completed yet.

 

This is what the Excel looks like:

Manager EmailReportOustanding training
manager.one@hotmail.comBilly Bob1, 2, 3, 4
manager.two@hotmail.comJoe Doe2, 6, 7
manager.one@hotmail.comSue Moe1
manager.one@hotmail.comRob Thob1, 2
manager.three@hotmail.comLazy Bones1, 2, 3, 4, 5, 6, 7, 8

 

This is my Flow:

Lebene_0-1617918380331.png

The manager receives a table like:

ReportOutstanding
Billy Bob1, 2, 3, 4
Sue Moe1
Rob Thob1, 2

 

My issue is that "manager.one@hotmail.com" will receive 3 duplicate emails instead of just the one. How can I prevent this? I've spent over an hour trying things like Initialize Variable/Union but I just get errors for that.

 

I appreciate any help, I'm still a novice trying to climb onto beginner so I'd appreciate if you don't assume I know what everything means as I'm still hack-jobbing things and not entirely understanding 'why' things happen yet.

 

Thank you

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Sort the Excel data source by manager Email.  Then use a loop to process the entries.  For each loop check first to see if the manager email is equal to the one from the last loop.  If it is then process the entry (but don't send the email just append it to a string or array). If its a different manager then send the info in the stored string or array to the previous manager, save the current manager as the previous manager, and process the entry.  Loop and repeat.

  • Community Power Platform Member Profile Picture
    on at

    Hi Pstork, thank you for your answer. Sadly, I just don't understand what it means.

     

    Are you saying I should do several apply to each? I searched 'loop' and it didn't show anything. Where and at what stage am I doing all of this? I'm a novice, no humble facades here.

     

    Thanks for your help

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    No I'm saying do one Apply to each after you have sorted the input by manager.  Then as you process each line check to see if the manager is different from the last line.  If it is then send the email.  If its not then store the information in some way and get the next line.

  • Community Power Platform Member Profile Picture
    on at

    Thank you Pstork,

    "Sort input by manager" - how? - I already have it sorted in the Excel file

    "Process each line" - is this a component or a condition? How, where does it go in my screenshot I've provided?

    "Store the information some way" - this is a manual operation or how is this done?

     

    I've been working on this part for over 1 hour but I've been working on this Flow for the past 6.5 hours almost non-stop.  I would really appreciate a short guide or screenshot because I don't understand what you're saying stemming from my inexperience and fatigue.

     

    Thank you again

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    1) its not sorted in the file you displayed.  the first and third row are manager.one and the second row is manger.two. There is an option to sort by a column when retrieving the rows from the Excel Table.

    2) I'm assuming you are processing each row in the apply to each in your flow now.  I'm just explaining what conditions and actions you need to apply to each row.

    3) You can either store the information by appending it to a string variable or adding it to an array.

  • Community Power Platform Member Profile Picture
    on at

    Ok, I see. That table is just an example I made in this forum to display the duplication and data examples. It is sorted in Excel.

     

    The apply each is sending the email

    Lebene_0-1617930372865.png

     

    I don't understand number 3.

     

    I don't really think I'll understand what you're saying without a demonstration, you are speaking theoretically on what I could do, but as I don't possess the knowledge to make sense of it, it's really just many words for me but limited meaning. I struggle with instructions without examples in general, especially when I am lacking basic knowledge on the matter. Even a typed flow demonstration would help me, as I just don't understand where you want me to put these, at what stage, within where and with what syntax.

     

    The flow I have now is:

    Man. trig. flow -> List rows in table -> Select -> Create HTML Table -> Compose (with HTML table styling) -> Apply to each from excel value (Send an email v2).

     

    Thanks again Pstork and I understand if you'd rather leave it here.

     

     

  • Verified answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Here's a sample set of screenshots

    image.png

    varmanager stores the last manager processed

    varTraining is an array that stores the rows as they are processed.

    image.png

    Apply to Each processes each row.  If the varmanager is empty (first row processed) or the manager equals varmanager (last manager processed), then 

    image.png

    Append the row to the varTraining array and update the last manager processed (this is really just to set it after the first row where varManager is blank)

    If the manager doesn't equal varManager do the No side

    image.png

    Convert the varTraining array into a table and send the email to the varmanager.  Then reset the varTraining array to the current row and varManager to the current row manager. (This is still inside the Apply to Each loop)

    image.png

    The Apply to each loop will now have sent emails to every manager except the last one.  So when you exit the loop Create one last html table and send it to the varmanager.  That will finish out the processing.

    image.png

  • Community Power Platform Member Profile Picture
    on at

    Hi Pstork, thank you for this detailed explanation.

     

    In this run-through, this is the behaviour I experienced:

    1. My email has 4 duplicates but it sent no emails, ignoring them altogether
    2. My 2nd test inbox had 2 duplicates but sent 4 duplicate emails

     

    I would want both inboxes to receive 1 email (there are 165 people who need to receive their individual email with varying number of reports).

     

    I have attempted using this method: https://www.flowjoe.io/2020/12/17/remove-duplicates-from-a-power-automate-array-with-one-action/ and https://flowaltdelete.ca/2020/06/03/power-automate-expression-union-return-unique-values/ but although I manage to get it to run, the duplicates still occur.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    I'm not sure how to help you further.  I created an excel table with the output you provided in your post and my example works perfectly for me.  I would go back and check your logic again.  You haven't followed the example I provided.

  • Community Power Platform Member Profile Picture
    on at

    This is what I attempted in another method, not your method. It errors when I use the duplicate output as saying it does not find the row with the email or does not recognise the array.

    screencapture-emea-flow-microsoft-manage-environments-Default-4473892f-71e0-46fc-8dec-273902b51349-flows-c66f260d-62ca-4d2d-a8dc-432eb4861cf7-2021-04-09-13_29_19.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard