cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

filter out duplicates

Hi,

 

I have a flow that is running against a document library once a week. It has two conditions:

 

  1. find all items that were modified the prior week.
    @greaterOrEquals(items('Apply_to_each')?['Modified'], addDays(utcNow(),-7))

  2. Of those items, find all items where the MMMulti field is empty.

    @empty(items('Apply_to_each')?['MMMulti'])

Once this is done I send an email to the document Author. This is all working fine. My question is this, users sometimes upload multiple documents. I don't want to send them an email for each uploaded document, just a single email. I am not familiar enough with Flow or arrays(?) and loops to make this work. I'm visualizing something that loops through all of the items after step 2, creates an array of Authors, remove items where the Author is duplicated within the array, then use the remainig array of Authors as the list to send emails too.... but I have no idea if something like this is possible. Does anyone have an example of a similar process they can share?

 

Thanks!

H

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: filter out duplicates

Hi @ Hid,

Do you want to send an email to the author if the author uploads one or more articles within two weeks?

What is the type of the MMMulti column in your document library?

 

I have made a test on my side , you could create a flow as steps below:

  1. Add a trigger “Recurrence”, the configuation of my flow would run at 10:00 on Monday every weeks.
  2. Add action “Get items”, fill in the “Site Address” field, and fill the document library name in the “List Name” field.
  3. Add a variable, name the variable as “All authors”, the type of the variable choose Array, leave the Value field blank.
  4. Add an Apply to each, add a Condition inside the Apply to each, the expression in the Condition as below:
@and(greaterOrEquals(items('Apply_to_each')?['Modified'], addDays(utcNow(),-7)),empty(items('Apply_to_each')?['MMMulti']))

      5. Add an append to array variable inside the If yes branch of the Condition, choose the All authors in the “Name” field, choose the “Created By Email” dynamic content of action “Get items” in the “Value”field. 

      6. Outside the Apply to each, add a Compose, the expression in the Inputs field as below:

 

union(variables('All authors'),variables('All authors'))

      7. Add an Apply to each 2, choose the Output dynamic content of Compose in the input field.

      8. Add action “Send an email”, choose the “Current item” dynamic content of Apply to each 2 in the To field, fill in the  Subject and Body field.

 

Image reference:

1.png2.png

 

The flow would run successfully as below:

 3.png

 

 

 

 

 

Regards,
Alice Zhang

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: filter out duplicates

Hi @ Hid,

Do you want to send an email to the author if the author uploads one or more articles within two weeks?

What is the type of the MMMulti column in your document library?

 

I have made a test on my side , you could create a flow as steps below:

  1. Add a trigger “Recurrence”, the configuation of my flow would run at 10:00 on Monday every weeks.
  2. Add action “Get items”, fill in the “Site Address” field, and fill the document library name in the “List Name” field.
  3. Add a variable, name the variable as “All authors”, the type of the variable choose Array, leave the Value field blank.
  4. Add an Apply to each, add a Condition inside the Apply to each, the expression in the Condition as below:
@and(greaterOrEquals(items('Apply_to_each')?['Modified'], addDays(utcNow(),-7)),empty(items('Apply_to_each')?['MMMulti']))

      5. Add an append to array variable inside the If yes branch of the Condition, choose the All authors in the “Name” field, choose the “Created By Email” dynamic content of action “Get items” in the “Value”field. 

      6. Outside the Apply to each, add a Compose, the expression in the Inputs field as below:

 

union(variables('All authors'),variables('All authors'))

      7. Add an Apply to each 2, choose the Output dynamic content of Compose in the input field.

      8. Add action “Send an email”, choose the “Current item” dynamic content of Apply to each 2 in the To field, fill in the  Subject and Body field.

 

Image reference:

1.png2.png

 

The flow would run successfully as below:

 3.png

 

 

 

 

 

Regards,
Alice Zhang

View solution in original post

Highlighted
Frequent Visitor

Re: filter out duplicates

Thanks a million Alice! I'll give this a try and let you know how it goes. My MMMulti field is a managed metadata multi-select field.

Highlighted
Frequent Visitor

Re: filter out duplicates

Alice's directions worked like a charm. Thanks!

Highlighted
Advocate II
Advocate II

Re: filter out duplicates

Why can't we have a simple expression like Nintex...  => RemoveDuplicates{Array} instead of a giant mess...   The suggestions in this thread doesn't fix Microsoft's motto "Workflow for everyone"...

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (6,630)