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 / Remove email duplicate...
Power Automate
Unanswered

Remove email duplicates when sending an email based on expiry date

(0) ShareShare
ReportReport
Posted on by 13

Hello all,

 

Before I start - I have spent a week or so looking for a resolution to this issue but have to admit that my knowledge of the tool isn't good enough to implement the many solutions that appear across forums like these. No case is similar enough for me to understand the nuances, and so im here asking for a pointer.

 

The flow im creating should do the following: Notify multiple users by email, based on a ‘review date’ expiring (or due to expire) for a document sat in a library on a SharePoint Online site.

 

Setup:

I have two columns, Lead Author and Contact, both of which can contain multiple users. (See below). For example, in my SPO document library I currently have two test items (Fire and Flood .docx) - These match the review date criteria to trigger the flow for each, and therefore an email to be sent for each. 

Query1.png

My flow is as follows:

Query2.png

Query3.png

Query4.png

Query5.png

Query6.png

Note: Ive used 'scoping' boxes to be able to quickly copy and paste the flow to work with a number of triggering time frames. For example, 3 months, 2 months and 1 month before the review date expires.

 

The Issue:

When i receive the email, each one contains my email address and the other test user email address multiple times. This seems to relate to the number of items that match the trigger criteria.

Query7.png

 

Expected Result:

Ideally, the Lead Authors and the Contact's should appear once in the To and CC fields of the email.

 

From what I've picked up so far, this may be due to the array operating in the wrong place or being immediately converted to a string? - Again im not familiar enough with the tool to see a way out of my specific example.

 

Any help would be much appreciated.

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @DGregory 

     

    To remove duplicates emails, you can use combination of union() & join() functions for both 'To' & 'CC' variables. Here is an example:

    ManishSolanki_0-1712138957486.png

    Below expression needs to be added in the expression box as highlighted in the above screenshot:

    join(union(split(variables('LeadAuthorEmailAddress'), ';'), split(variables('LeadAuthorEmailAddress'), ';')),';')

     

    Similarly, use the below expression for CC parameter:

    join(union(split(variables('ContactEmailAddress'), ';'), split(variables('ContactEmailAddress'), ';')),';')

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • DGregory Profile Picture
    13 on at

    Hi @ManishSolanki , Thank you for taking a moment to look into this.

     

    The solution you gave partially works, it does indeed remove the duplicate entries from the 'To' and 'CC' fields! However - the flow emails all users all reminders. Let me show you by way of example:

     

    Looking at the same Document library from before, now with 3 test documents and a combination of LeadAuthors and Contacts we have:

    Query8.png

     

    Note: Specifically following the top document, 'Flood', it has Lead Author as Daniel Gregory and the Contact as Test 365. Other documents have other combinations of Lead Authors and Contacts, specifically including the DEV1 DG user.

     

    All 3 of these documents trigger the flow as they all fit the same criteria/trigger. When the email(s) are received, specifically the reminder email regarding the 'Flood' document - I see the following:

    Query9.png

     

    The 'To' and 'CC' fields seem to include the contact details of all the documents that triggered at the same time. Similarly, the other two reminders setup for the other two documents include the same contacts in the To and CC fields.

     

    Im beginning to think i've set this up all wrong, and not sure how to proceed from here. Again, it feels very array related.

  • Verified answer
    DGregory Profile Picture
    13 on at

    I have a solution - I'll try to mark as solved so that others can find it.

    My flow is now set up like this:

    DGregory_6-1712226920655.png

     

    DGregory_0-1712226707762.png

    DGregory_5-1712226887620.png

     

    DGregory_2-1712226788443.png

    DGregory_4-1712226825822.png

     

    This flow will now send a single email for each 'item' to the people listed in the Lead Authors and Contacts columns.

     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard