cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LT91
Frequent Visitor

MS Flow - Delete SP list item based on 2 conditions

Hi,

 

I'm trying to build a flow that will delete SP list items based on what is in 2 columns. I've tried to build this a few ways but to no success despite searching around. The flows I've built are successful but are not deleting items that fit the criteria. If anyone could assist, that would be great!

 

Column 1: Condition equals 'Collected' (this is a drop down menu option)

AND

Column 2: Date Collected is greater than 90 days ago

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @LT91,

 

Below is an example. I would first properly test that before you add the delete item action though.

 

In my filter query expression example I am using a choice field called CollectedField and a datetime field called DateCollected. Amend that to reflect your internal field names.

(CollectedField eq 'Collected') and (DateCollected le '@{addDays(utcNow(), -90)}')

 

deleteolderitems_90days.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @LT91,

 

Below is an example. I would first properly test that before you add the delete item action though.

 

In my filter query expression example I am using a choice field called CollectedField and a datetime field called DateCollected. Amend that to reflect your internal field names.

(CollectedField eq 'Collected') and (DateCollected le '@{addDays(utcNow(), -90)}')

 

deleteolderitems_90days.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


@Expiscornovusthanks for this, it works perfectly. I even managed to improve some of my other flows using the filter query example rather than stringing together a condition!

Thomas23
New Member

Hi, this looks perfect for what I need. I have a similar issue but my column headers are 'QC Soft check needed?' and 'Date' I'm trying to get rid of anything with a No (from a drop down) and anything older than 5 days. 

 

Based on your advice I've used:

(QC Soft check needed? eq 'No') and (Date le '@{addDays(utcNow(), -5)}') 

 

When I test it tells me this expression is not valid. I'm totally new to this, any help would be greatly appreciated. Thanks

Expiscornovus
Super User
Super User

Hi @Thomas23,


In the filter you want to use the internal field names. You can check the name of the field in either the output of your get items or in the column settings of your list/library.

 

It probably is something like below:

(QCSoftcheckneeded_x003f_ eq 'No') and (Date le '@{addDays(utcNow(), -5)}')


Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,469)