web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Filtering an array using a 2nd array

(0) ShareShare
ReportReport
Posted on by 3

I have a list of documents in Sharepoint; each has an expiration date.  I have a Get Files list that filters everything due in the next 3 months.  That subset of documents has a few different document owners.

 

I have a list of Document Owners also (Owners).  I have a Compose Intersection to identify which owners have any document expiring in the next 3 months.  I would like to send an email to each of those owners listing all of their own documents expiring soon.  I want individual emails, not one big list; and I want one Flow, not one per person.

 

I have gotten a nice Flow sequence working great for ONE PERSON.  If I type in a name as part of one my filters, I can generate a one email to that person.  What I want, and cannot seem to figure out, is how to

1 - Apply to Each Owner in the Intersection Output

2 - Filter my Get Files array to only one Intersection Output Name at a time 

 

At most, this would be 10-12 emails sent monthly.  Each person might get notified of 1 to 10 documents they need to deal with.  I feel like I'm missing something super obvious.  Any help would be much appreciated.

 

I have the same question (0)
  • jiwhite Profile Picture
    498 on at
    Re: Filtering an array using a 2nd array

    In this kind of situation, I usually have a string array of the names of the people and an array of objects that represent what to send to whom. 

     

    The objects are structured like:

    {

      "name": "",

      "email": "",

      "documents": []

    }

     

    For each expired document, I get the name and email address of the owner.  If the name of the person is not in the name array, I add the name to the name array and create a new object to put in the object array. If the person is in the name array, I find the person in the object array and add the document to the documents object in the array by replacing the object with one with the document id appended to the array. After all of the documents have been processed, the objects array can be used to send one email with all of their documents' links or document attachments to each person.

  • maple4 Profile Picture
    3 on at
    Re: Filtering an array using a 2nd array

    @jiwhite Thank you, that does sound like exactly what I need.  Do you have an example you can post?  I'm not clear on which actions I need to do some of these steps.

  • jiwhite Profile Picture
    498 on at
    Re: Filtering an array using a 2nd array
    • For each expired document - Get Items with Filter, Apply to each
      • I get the name and email address of the owner. - Get item
    • If the name of the person is not in the name array - Condition contains
      • I add the name to the name array and - Append to array
      • create a new object to put in the object array. - Set variable, Append to array
    • If the person is in the name array - Condition
      • I find the person in the object array and add the document to the documents object in the array by replacing the object with one with the document id appended to the array. - Get item, Set Variable, Append to array 
    • After all of the documents have been processed, the objects array can be used to send one email with all of their documents' links or document attachments to each person. - Apply to each, Send an email

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 655 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 371 Moderator

#3
chiaraalina Profile Picture

chiaraalina 276

Last 30 days Overall leaderboard