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

Delete List Item based on column and date

Hi,

 

I have a list called Planner, within this list I have the following collums: Date, Name and description, I would like to be able to create a flow that every day looks for a date within the date collumn which is older than 2 days and delete the list item. Is this possible so far I haven't been able to work out a way to create a forumla for flow to understand what is older than 2 days.

 

All help is appreciated.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Delete List Item based on column and date

Hi @lewis1682,

 

Yes, this could be done.

For List item Date fields,  the date is older than 2 days when compared with current, then we could write the following formula to check (No need to add the calcualted field):

@lessOrEquals(
               formatDateTime(item()?['Date'],'yyyy/MM/dd'), 
               Adddays(utcnow(),-2,'yyyy/MM/dd')
                )

Function reference:

Workflow Definition Language

75.PNG

 

To use calculated field within SharePoint list should also work. But I think the calculated field should be:

[Date] + 2

If you would like to follow the flow configuration suggested by @douglasromao.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
douglasromao Kudo Kingpin
Kudo Kingpin

Re: Delete List Item based on column and date

Hi Lewis,

 

I think the better way to do this is creating a calculated field on your Planner List, you can create using the formula =[Date]-2, and setting this column as DateTime field on SharePoint like this example below:

 

2.PNG

 

After this, you can create a Flow using this condition to check if there is some list item with the date expired:

 

1.PNG

 

The primary condition is: @lessOrEquals(item()?['Date2'], utcnow())

 

This condition above will be responsible for validate if the value of the field Date2 is less or equals to now, and if this condition was true, will delete the item from SharePoint.

 

I hope I can help you, and if you need something I´m available.

 

Regards,

Douglas Romão

Highlighted
Community Support
Community Support

Re: Delete List Item based on column and date

Hi @lewis1682,

 

Yes, this could be done.

For List item Date fields,  the date is older than 2 days when compared with current, then we could write the following formula to check (No need to add the calcualted field):

@lessOrEquals(
               formatDateTime(item()?['Date'],'yyyy/MM/dd'), 
               Adddays(utcnow(),-2,'yyyy/MM/dd')
                )

Function reference:

Workflow Definition Language

75.PNG

 

To use calculated field within SharePoint list should also work. But I think the calculated field should be:

[Date] + 2

If you would like to follow the flow configuration suggested by @douglasromao.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

ncarrio
Frequent Visitor

Re: Delete List Item based on column and date

Hello! I have performed a Flow to delete items from a Field in a SharePoint List that specifically contain a word (Sí). I have done the syntax like this (Below)

But the result for each condition is FALSE so there is no items erased. Can someone help me?

 

Erase items.png

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (7,707)