cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gillgamm
Advocate I
Advocate I

Filter Sharepoint List by Person and Send Email with all items associated with their name

I have a Sharepoint list that has information uploaded to it on a weekly basis. On a recurring basis, I want a flow to filter by the person field and send all the associated items to each employee without having to send an individual email per item. I've tried a few different things with no success. I saw @Tmalonson do something similar but did not fit quite what I was looking to do.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Oh, well that would simplify this quite a bit.
So, what exactly are you just needing to include? Is it information that is part of the existing item?
As in, the information is simply within a different column on the same line item?

In that case, you should be able to OMIT all of the attachment steps and move directly into a
For Each(Item)Send an email V2 with specified format and dynamic content.
The problem you may run into is that it won't accept the email as dynamic content from get items.

You might need to set a variable within the For Each to hold the email address from the person column, and have it clear the variable after it sends the email (but before it finishes the loop).

Tmalonson_1-1700075618566.png

 

View solution in original post

There is another flow that I have that filters a flow based on a date of expiration, then sends a specialized email to notify the managers that they are coming due. Elements from that flow could also be used to inform this one. It depends on the information you're needing to communicate and how.
Mine was a tad complicated because it was needing to pull and communicate specific columns from the items; because of this, it had to run a manual filtering code on each item to determine if it should be included in the email body. 
But if we want to just include all the columns, you could format the email and probably use dynamic content within the body of the email.

View solution in original post

13 REPLIES 13
Tmalonson
Resolver I
Resolver I

Yeah, that is a tad different from what I was doing, but I think we should be able to use a similar process.
Edit: Just looked at the one you are referring to, can't use a similar process, but what you're wanting to do is still completely do-able.
Do you have a start of any sort of flow that I can reference?

Also, are you wanting the whole list to be processed each time? Or are there specific people that it needs to filter by?
Part of the problem being that if there is nothing specific to filter by, then the Get Items() action won't actually return any results to work with, but if there are specific employees that we can identify then this won't be an issue.
(There are some work-arounds to this problem, such as using a custom filter input like (Employee neq 'fx=null')
A filter like this would return all items in the list that do not have a blank person column. This would however result in a very laborious flow that would likely have a slow runtime depending on the size of the list.)

Which leads to my next question, how large is this list? What is our item count here?

It should be easy enough to consolidate the files into a single email per employee, as that's what I did previously.

Mostly, I'm just asking where I'm starting from here, because ground-up is a bit difficult without more knowledge of the list you're using.

Also, side note: I've since de-commissioned that flow because the list began exceeding the threshold. I had to re-build the list as a document library and have yet to re-build a flow to to the same result.

I'm starting from scratch at this point. Either a scheduled or a manual flow will work, Get all items (this list will be refreshed weekly with up to 100 items), filter by Employee column and send a single email containing all the list items assigned to a single person.

 

Okay, so here is what I would do.
It's a little un-orthodox, but I think it'll work.

To get the items initially, without bogging down flow, you can add a column in your list titled (Flow Modified), then hide the column in the view.
Then, in your flow, you use Subtract from time() action to pull the timestamp and subtract 5 hours. This will make sure that it doesn't pull the same item twice, because we are going make this flow loop until it doesn't pull anymore items.

In your Get Items() can now filter by "Flow modified is less than 'Calculated time' "
Then you'll want to set your top count to 20.
If the flow takes too long, simply lower this count until it functions within a manageable time frame.
Then, set a Compose() action with the fx(length(Dynamic content 'values from get items'))
Not only will this tell you during the run if you actually pulled the items, but we are going to use this later value to determine whether the flow loops.

Then, similar to how my flow operated, you can use a For Each(Get Item)Get Attachments Append to Array variable > Send Email V2 etc.

Then, at the end of the flow, not within any loops, you will create a condition.
IF( Compose(outputs (is greater than) Zero ) 
Condition YES(Resubmit FLOW() action)
Condition NO(Terminate Flow() Action) - Set the label to Cancelled

Set the ID of the resubmit flow to 1, then go back to your Trigger.

Open the trigger settings and set the Tracking ID to 1.

Here is a long-view of the general format; you'll want to refer back to my previous post that you kudoed for a more detailed explanation of getting the attachments.
Note: this explanation isn't exhaustive because, after looking at your P.A. profile, you seem pretty familiar with Power Automate; so, I excluded things I thought would be assumed such as Initializing Variables and Dynamic inputs. If you have any questions, don't hesitate to reply.

Once you get the flow made, you can probably change the trigger to a weekly scheduled, just remember that you'll have to correct the following items:
1. Subtract time from action

2. Trigger Settings - Concurrency Control and Tracking ID
Note #2: if the resubmit trigger doesn't work, you can change back to a manual trigger and put the terminate condition immediately after the compose() following Get Items(). Then you can just manually submit the flow a few times until it returns a "cancelled" label.

Tmalonson_0-1700071012631.png

 

gillgamm
Advocate I
Advocate I

What if I don't need to include attachments? Just the details of the list item.

Oh, well that would simplify this quite a bit.
So, what exactly are you just needing to include? Is it information that is part of the existing item?
As in, the information is simply within a different column on the same line item?

In that case, you should be able to OMIT all of the attachment steps and move directly into a
For Each(Item)Send an email V2 with specified format and dynamic content.
The problem you may run into is that it won't accept the email as dynamic content from get items.

You might need to set a variable within the For Each to hold the email address from the person column, and have it clear the variable after it sends the email (but before it finishes the loop).

Tmalonson_1-1700075618566.png

 

There is another flow that I have that filters a flow based on a date of expiration, then sends a specialized email to notify the managers that they are coming due. Elements from that flow could also be used to inform this one. It depends on the information you're needing to communicate and how.
Mine was a tad complicated because it was needing to pull and communicate specific columns from the items; because of this, it had to run a manual filtering code on each item to determine if it should be included in the email body. 
But if we want to just include all the columns, you could format the email and probably use dynamic content within the body of the email.

gillgamm
Advocate I
Advocate I

Could you expand on the Compose action and the Resubmit Flow? Resubmit flow is not an action I've used before. 

gillgamm
Advocate I
Advocate I

I'd like to include details of each list item in the email (assigned to that person) in a table as well.

Sorry for the late response, I was out for the Holdiday.

1. The Compose() action uses the length() formula. By using fx(length(dynamic content(Get Items[Value])) we are able to look at how much data was retrieved and use that number as a condition later.

Tmalonson_0-1701102742329.png

 



2. To format information from the list into a table, you should be able to insert a table within the email body.

Then, you should be able to place labels and dynamic content as desired.
i.e.

Name:dynamic content(Name): Joe Smith
Project Title:dynamic content(P-title): SharePoint Connectors
EtcEtc

If it doesn't allow for a table insert, you can still format the information as desired; it just a takes a tad more effort.

I.E.
Name: dynamic content(name)
Project Title: dynamic content(P-title)
etc.

Alternatively, you can place several things on the same line separated by colons: vertical lines | slashes/ underscores _ or whatever other method would look best.

 

3. When concerning he resubmit flow, when you go to look at it, it will have you set up the connection just like Get Items(). You will select the flow to be re-submitted, and set the "ID" as 1. The environment and trigger name are negligible. Personal Productivity should work, and whatever title you want to identify a flow triggered by the loop.

Tmalonson_1-1701102856197.png

Then, you'll need to make sure that in the settings of your Trigger() you set the ID to 1.

Tmalonson_2-1701102935599.png

If that seems too complicated, or doesn't work, you can move the condition immediately after the Compose() action and remove Resubmit flow(). (Example below)
Note: I realized that this flow will probably have a better runtime if we terminate when Compose(outputs) = 0

Tmalonson_3-1701103143556.png

If you choose to remove the Resubmit Flow(), then you'll just have to run the flow numerous times manually until a "Cancelled" condition is returned for the flow run.


Hi @Tmalonson ! I am hoping to figure out a similar flow but I have a few questions.

  1. Regarding the step in this response to "add a column in your list titled (Flow Modified)" , I wanted to know what type of column this should be and if anything should be added to this column for each item in the list. 
  2. I am guessing my second question is related to the first question but when I try to filter the List items by "Flow modified is less than 'Calculated Time'", the "less than" option is not on the drop down. EmilyK1_0-1705528688626.png

     

  3. Finally, my last question is regarding your guidance for resubmitting the flow in your last response on this thread. I am unable to use the "Resubmit Flow" due to data privacy policies - would manually re running the flow until it terminates produce multiple individual emails for each item in the list associated with the individual email?

Okay so,
1. The flow modified needs to be a date/time column, this column is to be auto-populated by the flow using the input fx = utcnow()

2. The greater than/less than issue should be solved once you have a column that supports that kind of input. The result you're seeing is because the column is a text value rather than date.


3. Interesting that you aren't able to use the re-submit flow, but not a problem. That somewhat depends on the list structure, size, and exactly what you're trying to achieve.
If the Get Items(Action) pulls too many at a time, it will take too long or it will return a null output because it reached a threshold of processable data.
Give me somemore examples and some flow structure and I can better help.

Thank you for such a quick reply! Given your response to question #3, I'm wondering if this solution will work for what I am hoping to achieve. 

Basically we have 400+ employees submitting trainings completed throughout the year into a Microsoft Form. As you can imagine, this leads to thousands and thousands of entries.  I currently have a flow set up where the Form responses are captured into a SharePoint List. I was testing/hoping to see if I could set up a flow that would either be triggered or run on a regular cadence to send an email to each employee that had submitted trainings so far, with a list of the trainings they had submitted from the SharePoint list. 

Given the scenario described, do you think it's possible to make this flow work with such a large volume of items in a list?

Like I said, it depends on how your list is set up.
If you are having thousands of inputs, I imagine that you are using different views to help organize the information?
Or, is it one line item per employee and forms populate other columns?
Being as we are looking to grab every item in the list at some point and collate them into different emails, we should be able to set a Return Count for Get Items to minimize this issue.

Alternatively, if you have different views for different branches, types of training, managers, or any other type of of organizational division, we can limit the flow by a view to minimize the datapool and simply copy the flow, then change the data pool.

It seems very likely that there is a way to accomplish what you want to do; but like I said, I'm working with minimal information. OH, and I realized that I failed to answer your original third question; re-submitting the flow manually would not result in sending the same information numerous times. The reason is because we are going to use the Flow modified column as a way to filter out items which have already been accounted for/sent out.

 

Helpful resources

Announcements

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!    

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Users online (6,539)