cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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

Hi @Anonymous,

 

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

Hi @Anonymous,

 

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

Anonymous
Not applicable

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (27,626)