- Please select -

Resolving “Failed to Delete Workflow. The Workflow Contains Files and Cannot Be Deleted”

Tips and Tricks Peter 23 August 2017

Resolving “Failed to Delete Workflow. The Workflow Contains Files and Cannot Be Deleted”

On occasion as a PDM administrator you may need to delete an old or no longer required Workflow from the vault.

When trying to do this you may get the below warning. This appeared when I tried to delete my workflow called ‘M Workflow’

Solidworks PDM Administration

Resolving “failed to delete workflow. the workflow contains files and cannot be deleted”

The problem is that even if you ‘currently’ have no files in the workflow in question, if a file has ever been through the workflow or any of its states and that file still exists in the vault, the delete attempt will fail.

To be able to delete the workflow all files that have ever been through it need to be destroyed (not just deleted and in the recycle bin)

It can be difficult to find files that have been through a particular workflow so to make it easier there is a SQL query that you can run. Note the fields I have highlighted in Red. These need to be set.

Resolving “failed to delete workflow. the workflow contains files and cannot be deleted”

You can see when I run the query there are a lot of files that have been through or are currently still in the workflow.

MS SQL Server Management Studio

Resolving “failed to delete workflow. the workflow contains files and cannot be deleted”

Result tab

 

Once these files are destroyed the workflow will be able to be deleted. In some cases this may not be practical as the files will still be required. In this case you would need to leave the workflow.

I have copied the text from the query below

/* find all documents in the specified workflow
ENTER the Workflow name at the SET command */

DECLARE @workflow AS NVARCHAR(255)

/* ——————————————
Put your workflow name in the statement below
eg: SET @workflow = ‘Design%’
The % sign is used as a wildcard
———————————————*/
SET @workflow = ‘m workflow%’

SELECT Documents.Filename, Workflows.Name
FROM Status INNER JOIN
Workflows ON Status.WorkflowID = Workflows.WorkflowID INNER JOIN
Documents ON Status.StatusID = Documents.CurrentStatusID
WHERE Workflows.Name LIKE @workflow AND Documents.Deleted = 0

Hope this helps.

Back to Tips and Tricks