cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
send2mark
Responsive Resident
Responsive Resident

Filter Query remove created by duplicates

I have a SharePoint list of 100 items with many of the items having the same Created by  person. I only want to send the email to each person once, but I would like to include the title column in the email that goes to each person. If that gets too complicated, I am good with sending out a generic email for everyone, but I would still only want the email to go out once per person.

 

How would the Filter Query look for something like this?

2 REPLIES 2
MarconettiMarco
Super User
Super User

Hello @send2mark ,

please follow these steps:

1. Initialize 2 Array variables:

MarconettiMarco_0-1660723188358.png

 

2. Get Items from your SP list without filters:

MarconettiMarco_1-1660723218896.png

 

3. Add a "Select" action in order to grab only the Author Email from the SP list:

MarconettiMarco_2-1660723254004.png

 

4. Add a "Compose" action putting the following expression:

union(body('Select-AuthorEmail'),body('Select-AuthorEmail'))

MarconettiMarco_3-1660723306519.png

5. Add an "Apply to each" loop in which add the following actions/controls (the "Select an output from previous steps" must be the previous Compose outputs):

MarconettiMarco_4-1660723365157.png

 

6. Get items from your list and apply the filter query where:

Author/EMail eq '@{items('Apply_to_each')}'

MarconettiMarco_5-1660723413153.png

7. Append to array "varItems" variable for each items found from the previous Get items action, putting the Title:

MarconettiMarco_6-1660723497867.png

8. Set the "varItemsDef" variable with the "varItems" values:

MarconettiMarco_7-1660723534458.png

9. Set the "varItems" variable in order to clear it (using square brackets):

MarconettiMarco_8-1660723572266.png

10. Add a "Compose" action putting the following expression:

join(variables('varItemsDef'),',')

MarconettiMarco_9-1660723613130.png

11. Add a "Send an email (V2)" action where:

- To: add the Current item:

-Email body: add the previous Compose outputs:

MarconettiMarco_10-1660723684942.png

 

If I have answered your question, please mark my post as Solved.
If you like my response, please give it a Thumbs Up.

BR,

Marco

 

 

 

 

 

 

 

Rhiassuring
Super User
Super User

Hi there, 


Sure -  your steps will look like this:

 

Step 1) Get Items - that's a normal one 🙂 

Step 2) Use the "Select" action - click on the little icon to the right of the field, make sure it looks like a little chart with no T in it. Add the dynamic content for the Created By or Assigned To or whatever you're using.

Step 3) Next, use a "Compose" action and use the "Union()" expression. In the parenthesis, put the Output from your select - on BOTH sides of the comma. (Yes, it's weird.) It'll be like Union(SelectOutput,SelectOutput)
Step 4) Now you'll be able to run for each of your Unique Users - so create an "Apply to Each" and point it at your Compose output.

Step 5) First item in the Apply to Each: Filter Array. Filter from the Get Items "value" - when YourField Email IS EQUAL TO Current Item.

Step 6) Use the Create HTML Table action. Point it at the Body of your filter array. Type in "Title" for your Header, and in the Value, add this expression: item()?['Title']

And finally, Step 7) Now you have an HTML table that you can plop into an email and send away - so your final action within the Apply to Each is just an email, with the output from the HTML Table in the body, and the email "To" is the "Current Item"

 

Rhiassuring_0-1660724476812.png

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (5,479)