Skip to main content

This has been posted but never answered so I'll try again.

I have 250+ sites that have about 5 workflows each that need to be deleted as they are no longer in use. 

I have scripted out a process that looks for a named workflow and a named list and if there are any running instances of that workflow it cancels them, then uses "workflowAssociations.Remove" to remove that association from the list (or site for site workfows). THey still show up in the Site Worklfow Inventory. The next goal is remove them from the site inventory. Is this only possible via the WorkflowGallery.aspx page? Doubtful but..any ideas?

what I've discovered is that by grabbing the workflowassociations collectoin for the splist or spweb object and using. Remove, it will no longer be associated with the spObject. It will, however, continue to show in the contentDB table "Workflows" and so it will also display on the Workflow Inventory page. There is a stored proc called DeleteWorkflow which contains:



 



DELETE
FROM Workflows
WHERE SiteId = @SiteId AND WebId = @WebId AND ListId = @ListId AND WorkflowId = @WorkflowId



 



Running that query on your sites Nintex contentDB will remove it from the Inventory page



The workflow will still have an entry in the Nintext Configuration DB in the table PublishedWorkflows



You can delete it from this table by using



 



delete from [dbo].[PublishedWorkflows]
where SiteID = 'Your_Site_ID' and WorkflowName = 'Your_Workflow_Name'



 



If you don't know what the site ID is you can run the following query to get it



 



USE YOUR_NINTEX_CONTENTDB; select top 1 SiteID from WorkflowInstance



 



 


In the solution I've provided I assume there is a one to one mapping of contentDBs to site collections. You may need to add additional where clause elements in your environment.

Reply