cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hid
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
v-yuazh-msft
Community Support
Community Support

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
v-yuazh-msft
Community Support
Community Support

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

Hid
Frequent Visitor

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.

Hid
Frequent Visitor

Alice's directions worked like a charm. Thanks!

testasdfasfsafa
Advocate III
Advocate III

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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (76,295)