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

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

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.
2 REPLIES 2
Community Support Team
Community Support Team

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.
Marco_Schade
Level: Powered On

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 Smiley Happy  

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fourthImage

Australia Summit

Travel to Melbourne and network with thousands of peers!

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 173 members 5,017 guests
Recent signins:
Please welcome our newest community members: