cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Copy item from sharepoint list if item is created more than 10 days ago

Hi,

 

I am trying to make a flow that copy an item from one SharePoint list to another if the item is more than 10 days old. This is done for archiving reasons.

 

As specified in the pics below i use "Select" to get the outfor for however days has past since the item was created. I then make an apply to each with a condition that says length('Days since creation') is greater than 10.

 

I think that "lenght" should get me the output from the "Select" action. I have a hard time figuring out what it is actually comparring. Since the outcome seems somewhat random.

 

 

How do i get i to look at the outputs individually and based on that only copy those who are true in terms of the conditions?

FLOW 1.jpg

 

Select action specified:

 

FLOW 2.jpgFLOW 3.jpg

 

Condition specified:

 

FLOW 4.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Copy item from sharepoint list if item is created more than 10 days ago

Hi @Marco_Schade,

 

Do you want to get items from a list that were created 10 days ago? Do you have a column for Created Date in the list?

 

I have made the following test on my side. There is a Date column for the created date in the list, it is formatted as Date only.

In the Get items action, use the following code in the Filter query field:

Date le formatDateTime(addDays(utcNow(),-10),'yyyy-MM-dd')

Note: Make sure the formatdDateTime function is surrounded by a single quote.

 

Then under the action Apply to each, add the action Create item, fill the filed with corresponding dynamic contents.

1.PNG

 

Please take the following doc on Filter query and WDL for more details:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
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
Highlighted
Community Support
Community Support

Re: Copy item from sharepoint list if item is created more than 10 days ago

Hi @Marco_Schade,

 

Do you want to get items from a list that were created 10 days ago? Do you have a column for Created Date in the list?

 

I have made the following test on my side. There is a Date column for the created date in the list, it is formatted as Date only.

In the Get items action, use the following code in the Filter query field:

Date le formatDateTime(addDays(utcNow(),-10),'yyyy-MM-dd')

Note: Make sure the formatdDateTime function is surrounded by a single quote.

 

Then under the action Apply to each, add the action Create item, fill the filed with corresponding dynamic contents.

1.PNG

 

Please take the following doc on Filter query and WDL for more details:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
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

Highlighted
Helper I
Helper I

Re: Copy item from sharepoint list if item is created more than 10 days ago

Hi @v-yamao-msft

 

Yes, I wanted to get those items that was more than 10 days old and move those to another list.

 

Additionally, I want to delete them from the old list, but I guess that is just inserting a "Delete item" into the apply to each and then choose the Id from the "Create item" action. 

 

The flow you have described workes perfect and I found out that by changing the "Date" in the string to "Created" I can make it look at the created column which SharePoint creates by itself.

 

Thanks 🙂  

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Kudoed Authors
Users online (6,689)