There could be many business scenarios where you will be required to move/copy items from one list to another, below I have highlighted some of the scenarios:
- List threshold (5000 items) reached
- Archived list items based on the dates – For example move all data six months older.
- The user should not be able to see the item after they have completed/submitted a request/item. For example, expense form once approved user have no access.
In this blog, I will focus on how to automatically (through a recurrence task) copying the data (and deleting the items so effectively moving) from one list to another for archiving purposes based on a condition.
I am assuming you know how to create lists in SharePoint. We will need two lists with exactly the same fields i) Target and obviously, the Destination list.
There are two ways to create a Flow:
SharePoint Modern List Flow
Microsoft Flow App/Portal – Create a blank flow
The first step, Add a ‘Recurrence‘ action. Recurrence allows us to schedule task based on the frequency and interval, for example, repeat every 10 minutes.
Get the items you would like to move/copy and define conditions. The Get Items action accepts OData conditions. You want to learn more about OData filters here. I have defined a condition based on the expiry date greater than or equal to and column (called Moved) ‘No’.
Create an action for ‘Add an Apply to each’. I have created a selected item in the destination list and delete or update (if you want to) items on the target list.
Create Items and map the fields/column from Target to Destination list
Update Items on the target list if you don’t want to delete the item (Optional)
Delete the items from the Target list based on the item.
If you have other business scenarios you think this could be useful, please drop a comment.