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

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
Community Support Team
Community Support Team

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

2 REPLIES 2
douglasromao
Level 8

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

Community Support Team
Community Support Team

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

Helpful resources

Announcements
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!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,060)