Delete of Job or Task fails with "Failed to delete item" error
search cancel

Delete of Job or Task fails with "Failed to delete item" error

book

Article ID: 164044

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

An attempt to delete a Job or Task from the Symantec Management Platform (SMP) console fails and an error is generated in the SMP logs.

Failed to delete item: <Job GUID>
At least one instance of the task job <job Name>' (<Job GUID>) is running and cannot be deleted. You can delete the task after it has completed or stop it manually and try again.  
 

Cause

This can be caused by either there being an instance of the task still running, or the record for the task still has a flag in the database set indicating it is still running even though it has completed.

Resolution

In the event that there is still a running Job or Task, simply canceling it should clear the flag and allow it to be deleted.

If there are no instances of the Job or Task still running in the console then the following SQL query can be run to clear the flag, then the Job or task can be deleted.

update TaskInstances
set TaskInstances.InstanceStatus = 2
from ItemVersions iv
where iv.VersionGuid = TaskInstances.TaskVersionGuid
and iv.ItemGuid = 'JobGuid' --replace the JobGUID text with the GUID from the error message keeping the single quotes
and taskinstances.InstanceStatus = 1