cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kederose
Regular Visitor

Flow - Filter SharePoint list based; older than 60 days

Hello, 

I am new to Flow. I am wanting to create a flow that after 60 days will move the list to an archive folder and delete. 

I am open to anything sugguestions at this point this is what I have tried so far. 

I am wanting to archive a SharePoint List after 60 days based on the column called "Last Day of Month" or Date (either is sufficent)

I am getting errors after errors. 

 

 

The error is 

The expression " 2019-07-02le'05-04-2019'" is not valid.
clientRequestId: c68ac8fe-1887-45b0-884c-a3e027ec205b
serviceRequestId: c68ac8fe-1887-45b0-884c-a3e027ec205b

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi  @kederose ,

 

Thanks for your reply.

 

Please see the below flow steps.

 

Here I used the created date of the list record.

 

First find todays date and formatted to yyyyMMdd format.

 

 

d11.png

d12.png

 

d13.png

 


The expression I used is

 

formatDateTime(adddays(items('Apply_to_each')?['Created'],60),'yyyyMMdd')

 

I am sure we could use all in one condition instead of the variables but the flow run details under the if condition expression will show only true or false not the values which compared and difficult for debugging purpose. Hence I used the variable here. 

 

I did tested the flow and it did worked as expected.

 

Let me know the results.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

Hi @kederose ,

 

Please see below flow steps under the Yes condition. Before you start creating the flow step create a new list with same metadata. Below I have created a list called 'aj'.  In flow step create item we can map the values from old list record. Once the record is mapped then add a new step called delete item list record and map the id from the old list.

 

d14.png

 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

9 REPLIES 9
kederose
Regular Visitor

 

@LastDayofMonth ‘addDays(utcNow(),-60,’yyyy-MM-dd’)’ is the code, I have been trying to use. 

Hi @kederose ,

 

Are you trying to find the SharePoint list records older than 60 days?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
kederose
Regular Visitor

Yes, if the list item is past 60 days, I need to copy(but not an option for me) the list to my archive list folder and delete.

Hi  @kederose ,

 

Thanks for your reply.

 

Please see the below flow steps.

 

Here I used the created date of the list record.

 

First find todays date and formatted to yyyyMMdd format.

 

 

d11.png

d12.png

 

d13.png

 


The expression I used is

 

formatDateTime(adddays(items('Apply_to_each')?['Created'],60),'yyyyMMdd')

 

I am sure we could use all in one condition instead of the variables but the flow run details under the if condition expression will show only true or false not the values which compared and difficult for debugging purpose. Hence I used the variable here. 

 

I did tested the flow and it did worked as expected.

 

Let me know the results.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
kederose
Regular Visitor

Thank you so much.I got everything from the images below to work. Can you tell me now how to get  the list items copy/create/move the item that is past the 60 days into another folder and delete from the original list, much like an archive feature?  That is my last task, I am needing. Thank you again for your help so far. 

Hi @kederose ,

 

Please see below flow steps under the Yes condition. Before you start creating the flow step create a new list with same metadata. Below I have created a list called 'aj'.  In flow step create item we can map the values from old list record. Once the record is mapped then add a new step called delete item list record and map the id from the old list.

 

d14.png

 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
kederose
Regular Visitor

 

 

 

 

Hello Again, 

I tried your steps above. I created the new list created from the old list as template. 

I could "Title" as option to pull from the dynamic content options. I picked a couple from the list. The flow says it ran successfully, but nothing has been moved or created and I looked a little deeper and found this error. Any ideas what I should do now? 

Thank you again for your help!

 

 

second part error.jpg

abm
Super User
Super User

Hi @kederose ,

 

It's difficult to analyse from the screenshot you had given.  How many records you expecting to satisfy the yes condition. You need to click the next record for each from your run log foreach. I would say it's your data is not right which is not going through the Yes condition.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
kederose
Regular Visitor

Thank you for your help! I unhid the title column and changed one of the expressions to greater than or equal to and it worked!! Thanks for all your help!!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,808)