Cmdb_health_result record references deleted CI when CMDB Remediation Rule execution is Automatic and the remediation deletes CIs


Description

Cmdb_health_result record references deleted CI when CMDB Remediation Rule execution is Automatic and the remediation deletes CIs

Cause

  1. Health results reference task
  2. The task needs to be created first so that the cmdb_health_result.task field can be populated with the sys_id of the task
  3. The remediations are either triggered at the time of the creation of the task, when set to automatic, or at a later time
  4. If a script executed by the remediation deletes CIs, and the execution is set to automatic, then deletion will happen before the cmdb_health_result is created
  5. For this reason, the cascade delete configure OOB for cmdb_health_result.ci will not delete the Health Result

Resolution

The delete needs to take into account that records which point to the CI may not yet exist at this time. A couple solutions are: