Skip to main content
Nintex Community Menu Bar
Solved

Delete Workflows from Site Workflow Inventory With Powershell

  • March 14, 2022
  • 2 replies
  • 398 views
  • Translate

Forum|alt.badge.img+8

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?

Best answer by vacoder

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

 

 

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+8
  • Author
  • Rookie
  • 75 replies
  • Answer
  • March 14, 2022

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

 

 

Translate

Forum|alt.badge.img+8
  • Author
  • Rookie
  • 75 replies
  • March 31, 2022
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.
Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings