How to pruge the data for the deleted list item (purge nintex workflow data)
item has ben deleted but the workflow history is not cleared.
Solved! Go to Solution.
Go to Site Settings->'Purge workflow data'. Select 'Custom Filter'. Select 'List Name is' and the name of the list. Add another filter that will help you find the item that was deleted by clicking 'Add filter'. Then hit the Query button. The query results appears at the bottom of the page. Make sure your only the items you want to purge appear. Click the purge button.
This only deletes "completed, Cancelled or Erroded" workflows. How then would you delete "running" workflows of deleted list items?
I found it! You have to have access to "Central Administration" where you can change the "State" to include "Running."
Is there no way to Query based upon Item: Cannot find list item? That would be the easiest way possible to clear these out.
This shouldn't be the accepted solution. There is no filter for purging where items have been deleted. It would be nice if there were.
In the DB there is a column called ItemDeleted on the WorkflowInstanceView but not sure what this is for...
It can be done via SQL and I wrote the attached. I'm sure it could be optimised but didn't spend a lot of time on it. There is a stored procedure (create it first) to check for a deleted item. This is then called through the others.
Due to the time it takes to check for a deleted item (about a sec in my case) and the number of workflow instances you may have in the workflow instances view (145k in my case) it may take a while to run. This is why I’d recommend you limit running it, to a single list or smaller criteria.
To test, you can use the "NintexWFInstances_IdentifyDeletedItems.sql" to identify WF instances against deleted items or not. Again, I have it limited to a single list (2k instance records). Just update your SiteID and ListID to your own.
@listid uniqueidentifier = '5C1406F5-7EBC-4A82-9B3B-2D1B557E517F',
@siteid uniqueidentifier = '9C1ABE29-7AA8-4D98-A27D-77060D54A48A',
Then when your happy with the output from above, you can use NintexPurgeWorkflowData_DeletedItems.sql to purge the workflow data against deleted items. You will need to update the ListID and SiteID to your own prior to use.
I take no responsibility for any damage incurred. You should always take a backup first and not run on any production environments. Use at your own risk! The following should also be noted.
Read operations addendum
Reading from the SharePoint databases programmatically, or manually, can cause unexpected locking within Microsoft SQL Server which can adversely affect performance. Any read operations against the SharePoint databases that originate from queries, scripts, .dll files (and so on) that are not provided by the Microsoft SharePoint Development Team or by Microsoft SharePoint Support will be considered unsupported if they are identified as a barrier to the resolution of a Microsoft support engagement.
If unsupported read operations are identified as a barrier to the resolution of support engagement, the database will be considered to be in an unsupported state. To return the database to a supported state, all unsupported read activities must stop.