cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cooper33
Level 8

SharePoint: Send email to unique addresses Created By with a count of times they appear

I am trying to build a Flow that gives the user a summary of requests they submitted. I am storing items in a SharePoint list but since users often add many items, I don't want to send an email On Item Add because they'd get too many emails

Instead I want to send a summary email. At a high level, each day the flow would run and build a unique list of email address that have been added to the list in the last 24 hours. Each time the same email address appears in the query then a total would increment by one so that the email body to each user would say something like You added X items on [Today]

I can get the unique emails by building an array and then using Contains to only add unique users. I am assuming I shouldn't use an array data type if I want to store a number.

Can anyone explain how I can accomplish this?

1 ACCEPTED SOLUTION

Accepted Solutions
cooper33
Level 8

Re: SharePoint: Send email to unique addresses Created By with a count of times they appear

I got this to work by building the same array with unique emails. After building the array, I loop through each and use the Get Items action to find items created in the past 24 hours where Created By email = current email in array

Created ge '@{formatDateTime(addDays(utcNow(),-1),'yyyy-MM-dd')}' and Author/EMail eq '@{items('Apply_to_each')}'

*Note the casing of EMail above is not a typo*

Then I used compose to get the length of get items and added it to the body of my email

 

Still feeling like this isn't the most efficient solution so if anyone has other ideas I'd love to hear

1 REPLY 1
cooper33
Level 8

Re: SharePoint: Send email to unique addresses Created By with a count of times they appear

I got this to work by building the same array with unique emails. After building the array, I loop through each and use the Get Items action to find items created in the past 24 hours where Created By email = current email in array

Created ge '@{formatDateTime(addDays(utcNow(),-1),'yyyy-MM-dd')}' and Author/EMail eq '@{items('Apply_to_each')}'

*Note the casing of EMail above is not a typo*

Then I used compose to get the length of get items and added it to the body of my email

 

Still feeling like this isn't the most efficient solution so if anyone has other ideas I'd love to hear

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 135 members 3,636 guests
Please welcome our newest community members: