After removing a task from a job the item reference is still there, thus unable to delete the task that was removed from the job just moments ago.
Steps to duplicate issue:
This issue seems to be introduced in ITMS 8.6 RU1 version. Previous version 8.6 this problem is not observed.
The customer has been using the following query in order to get rid of the task by removing the reference manually:
delete from ItemReference
where ChildItemGuid in ( Select vitem.guid
From vitem
Where vitem.name = 'ENTER_TASKNAME_HERE')
NOTE: Make sure the task name is unique before running the above SQL
ITMS 8.6 RU1
Known issue
This issue is fixed in ITMS 8.6 RU2.
Workaround for those in 8.6 RU1:
A pointfix is available. See KB 221269 "CUMULATIVE POST-ITMS 8.6 RU1 POINT FIXES"
After installing the pointfix, run the attached nscript "job-resave-referenced.cs" placed along with pointfix, but not executed automatically.
To fix "lost" references - all the jobs have to be re-saved, and you'll need to execute the nscript with Nscript.exe.
How to run the nscript, refer to:
https://knowledge.broadcom.com/external/article/179744/what-is-nscript-and-how-does-it-work.html
Example:
C:\Program Files\Altiris\Notification Server\Bin> nscript.exe job-resave-referenced.cs