Question

Bulk Delete to clear out multiple lists

  • 11 November 2023
  • 4 replies
  • 34 views

Badge +4

Hello,

I have a Nintex O365 Site workflow that queries several Workflow Task lists with a filter [Task Status] is equal to “Completed” using Query List.  For each list, I loop through the collection, capture the ID and delete the corresponding item.  This workflow is working fine.  However, since we have so many tasks, it takes hours to run.  Is there a more efficient/faster way to handle this?

Thank you.

 

 


4 replies

Userlevel 6
Badge +16

Hi @SShaffer2 

Use PowerShell scripts to loop thru the Workflow Task Lists.

 

 

Userlevel 6
Badge +16

Use 2 sets of scripts.

First script to list out the ID of the items to be deleted. 
You can test/run this script multiple times.


Second script to delete the items.
Since this will actually remove items, use caution when you test/run this script
Limit the scope by use the “-WhatIf” parameter
Limit the scope by manually removing 1 item at a time
Limit the scope by setting a fixed ID to exit the loop. If ID > 10, exit script

 

Also use PowerShell PnP batch feature

 

If you prefer to use NIntex Workflows, consider to use Nintex Automation Cloud (NAC). NAC workflows are much faster to execute when compare to O365. No NAC, then use a 30-day trial 

Badge +4

Thank you for your reply.  I do not know PowerShell nor do I have access  (for now) to a person/team that could help so I was hoping to accomplish this using SharePoint/Nintex O365.  We will be moving to NAC in 2025, but I was hoping to come up with a solution right now.  

 

@Garrett I am not familiar with the -WhatIf parameter.  Where do I find that? 

Userlevel 6
Badge +16

Hi @SShaffer2 

  1. I would recommend that you get your hands on a 30-day NAC Trial.
    NAC workflows are much faster than O365 workflows.
  2. Just place the -whatIf parameter at the end of a PowerShell cmdlet
  3. You can still accomplish your goals with O365 workflows.
    Have you considered running multiple site workflows where each site workflow is working on a single workflow Task List. This should slightly boost performance, I believe.

 

Reply