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
abm
Super User III
Super User III

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 blogPower Automate Video Tutorials

View solution in original post

abm
Super User III
Super User III

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 blogPower 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. 

abm
Super User III
Super User III

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 blogPower 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.
abm
Super User III
Super User III

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 blogPower Automate Video Tutorials

View solution in original post

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. 

abm
Super User III
Super User III

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 blogPower Automate Video Tutorials

View solution in original post

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 III
Super User III

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 blogPower 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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,392)