Why workflow version records should not be deleted
On the ServiceNow Platform, the Workflow Editor within the Workflow module allows users to create new and update existing workflows for each application. An example reason that a workflow might be implemented is for Incident Management or Change Management.
Processes change over time, and therefore the platform uses versioning to update workflows without affecting existing running workflows within the platform. Workflow versions are stored in a table called wf_workflow_version.
However, in-flight records, such as Change Requests and Incidents, are using the older wf_workflow_version as a reference to run the workflow. The in-flight workflows are stored in a table called wf_context.
Deleting records within the wf_workflow_version table causes in-flight records, such as Change Requests and Incidents, to lose reference to their version. Therefore any approvals and tasks scheduled to be created by the in-flight workflow are not created, and therefore from an end-user point of view, the related record associated to the wf_context does not complete its execution.
Therefore do not delete wf_workflow_version records as this causes a huge impact to a ServiceNow instance.
Symptoms of workflow version deletion
The symptoms of a wf_workflow_version record being deleted are the following:
- Empty value in the reference field Workflow Version on the wf_context table
- Approvals and Tasks not being created on in-flight records
Due to the security enhancements in the platform, System Administrators cannot delete wf_workflow_version records if there is a reference that exists in the wf_context table, where the state of the wf_context is Executing.
However, the main cause of the deletion of wf_workflow_version records is when a user runs a background script to perform this action.
Please note that ServiceNow Support does not advise nor support the use of a script to delete a wf_workflow_version.
If you do not wish for a wf_workflow_version to be used for new records, set a wf_workflow_version inactive by performing the following steps:
- Navigate to Workflow > Workflow Editor
- Open any workflow. For example, Change Request - Normal
- On the title bar, click on the menu icon and select Set Inactive
Important: The Set Inactive option is only available if the version of the workflow is not referenced in an executing wf_context record.