Forum Discussion
Filter a SharePoint list by any column, then run a PowerAutomate flow to report
I have a SharePoint list whose entries are different service areas like counseling contacts, school nurse contacts, police contacts, etc. Is there a way that a person can filter the SharePoint list then click a PowerAutomate flow to have it print the contents of the filtered list to say -- a PDF?
4 Replies
- Adeboye_OlaideCopper ContributorHello Annette
Yes, it is possible to filter a SharePoint list and use Power Automate (formerly Microsoft Flow) to generate a PDF of the filtered results. There are some steps you will need to follow to get it done and create the folder. Reach out for further discussion- Rob_ElliottSilver Contributor
Adeboye_Olaide you said there are a few steps to achieve this, but your response would have been a bit more useful if you had said what those steps are. in 6 years of using Power Automate I have never heard of a flow being able to run based on an already-filtered list. The get items action doesn't have any mechanism to do this which is why you need to use the filter query in the get items action.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)- michalkornetIron Contributor
Hi everyone,
Adeboye_OlaideI am also curious if you have a good method to achieve the initial requirement.
Rob_Elliott , I also haven’t seen any possibility to do so, except through some customizations and SPFx custom code.
The method I found, though not simple or perfect, is as follows:
1. Create a flow with the ‘For Selected Item’ trigger connected to the list.
2. Filter the view and trigger the flow.
3. Take the entity/itemUrl from the trigger body and parse it to filter SharePoint items in the ‘Get Items’ action.The body of the trigger contains information like this:
{
"entity": {
"ID": 1,
"itemUrl": "https://tenant.sharepoint.com/_layouts/15/listform.aspx?PageType=4&ListId=%7BFCB39539-A5B2-4DF7-8976-640C664AAD64%7D&Source=https%3A%2F%2Ftenant.sharepoint.com%2FLists%2FTestTarget%2FAllItems.aspx%3FisAscending%3Dtrue%26FilterField1%3DLinkTitle%26FilterValue1%3DTest%25201%26FilterType1%3DComputed%26sortField%3DNumber%26viewid%3D1f2ca575%252D28b3%252D4f9f%252Db2fc%252D4def60cd511c&RootFolder=%2FLists%2FTestTarget&ID=1&ContentTypeId=0x01008C2547E6CB5DF14DBA8C515119A17E31005233037E1B0B314B812A705A5474F337",
"fileName": "Test 1",
"FileId": "1"
}
}I am wondering if you have a better idea on how to achieve this without custom code
- Rob_ElliottSilver Contributor
Annette1101 no, a flow can't run based on a filtered list. In your flow you will need a filter query in your get items action to get the items you need then create the PDF.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)