cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DI123
Level: Powered On

Filter Items on a SharePoint List

Hi All,

 

I'm currently trying to create a flow that sends an email notification when a SharePoint list item is due 7 days from today's date. I have been able to create a flow that does this successfully, however I need to be able to filter between Active or Closed risks and for the flow to only pull through the Active risks. I was wondering if it's as simple as just adding a bit more information in the filter query?

 

At the moment my steps are as follows:

 

- Recurrence

- Get Items (includes a filter query to pull the date through, which I have attached a screenshot of)

-Apply to Each (Value)

- Condition (@lessOrEquals(items('Apply_to_each')?['RiskEventDate'], formatDateTime(addDays(utcNow(), 7)))

- If yes, send an email.

 

Any help would be greatly appreciated.

 

Flow Screenshot Get Items.PNG

3 REPLIES 3
Community Support Team
Community Support Team

Re: Filter Items on a SharePoint List

Hi @DI123,

 

According to your description, it seems that you would like to filter items that are Active as well.

Please check the following configuration for a reference.

For testing, create a List A includes columns Title, RiskEventDate (Date and time) and Status (Choice).

Add a Button trigger.

Add the action Get items, enter the following code in Filter Query field:

Status eq ‘Active’ and RiskEventDate ge ‘formatDateTime(utcNow(),'yyyy-MM-dd') and RiskEventDate le ‘formatDateTime(addDays(utcNow(),7),'yyyy-MM-dd')’

Add a Compose action to return the filtered Title.

Please check the following screenshot:

1.PNG

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
DI123
Level: Powered On

Re: Filter Items on a SharePoint List

Hi Mabel,

 

Thank you for your reply. Unfortunately, when I add State eq 'Active' to the filter query in the get items step the flow does not run successfully.

 

I have attached a screenshot of all of my current steps below.

 

Flow Screenshot Example.PNG

DI123
Level: Powered On

Re: Filter Items on a SharePoint List

Hi,

 

I have managed to find a solution to the issue. It was just a case of adding the internal column header at the beginning of the filter query so my filter query was as follows:

 

Risk_x0020_Status eq 'Active' and RiskEventDate ge '@{formatDateTime(utcNow(),'MM/dd/yyyy')}' and RiskEventDate le '@{formatDateTime(addDays(utcNow(),7),'MM/dd/yyyy')}'

 

Thank you for your help.

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Coming Soon: T-shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Power Platform World Tour

Find out where you can attend!

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