JOIN OVER 3,000

Subscribers who get fresh content to help their business weekly...

Categories
Categories

As everyone is aware that there is a limitation for the items that can be stored in the SharePoint list , if the list item reaches 5000 items the views which are present will not be visible due to the threshold limit which was a restriction from Microsoft. In order to overcome such issues, we need to either archive the items available in the list or delete the list item after a certain number of days. This article explains how the documents can be deleted after 90 days based on the item’s modified date. You might think that this can be feasible using retention policy but the custom columns and lookup columns won’t be visible in the retention policy page which is one of the disadvantages of retention policy.

Power Automate Site Workflows

We can create a flow by directly opening Power Automate (https://powerautomate.com/ ) or directly opening from the list / library.
To open from the list/library select the Automate option from the ribbon → Create a flow

Once you click on create a flow a small box open in the right side ,scroll down and click more it redirects to the flow page

from New select the template Automated-from the blank

Step 1 Use action Recurrence, this is a conditional block where we set when the flow should run and at which time, here we have configured the flow to run on weekly Friday at 6.30 AM IST ( timing is based on our own wish any time can be set)

Step 2: To get the item from the workflow task list use the action Get Items, this block gets the data from respective task list based on two different conditions i.e., Status equals ( eq) to Completed and count which takes Top count 5000 items. Based on these conditions the items get filtered out.

Step 3: Use Apply to each action in order to loop the items which are retrieved. Then check the condition if the modified date is equal to 90 days or not using the below formula in the expression box.

Use this formula for comparison in the div(sub(ticks(formatDateTime(adddays(utcNow(), -90), ‘yyyy-MM-dd’)),ticks(item()?[‘Modified’])),864000000000).

Step 4: If the above conditions are matched then it goes to YES block and deletes all the fetched data based on ID.

Leave a Reply

Your email address will not be published. Required fields are marked *