Notifications

17 views

Description


A reference field is a pointer to a record in another table, and the value is a sys_id of that record. If that record sys_id is actually missing from that other table then we call that a Broken Reference, and when you click through to that reference you get error 'Record not found'. Here is how to find those records with broken references from a List view filter, so that you can repair them.

Procedure


  1. Open the list for the table you are interested in.

  2. Add this filter to the condition builder: (I'll call the field you are interested in <reference field>)

    <reference field> IS NOT EMPTY
    AND
    <reference field>.'Sys ID' IS EMPTY

    That second condition is dot-walking to the sys_id field of the record in the referenced table. Expand the reference field first, then select 'Sys ID'.

  3. Run the filter.

Every record displayed in the list will have a broken reference in that field. A sys_id value may be displayed, or the field may appear empty but isn't. You can correct the value by editing from the list view.

Example


The CMDB Relationships table [cmdb_rel_ci] is a common cause of problems in some CMDB related features such as Relationship Editor if records have a broken reference.

Main reference fields in this table:

  • Parent - References cmdb_ci
  • Child - References cmdb_ci
  • Type - References cmdb_rel_type - The field used in the example below, using the above steps. 

 

Applicable Versions


Up to and including Kingston, and probably later. Works with List v1, v2 and v3.

Additional Information


This trick also finds records that reference Archived records, that were moved out of the original table by the optional Data Archiving plugin. You can confirm that by clicking through to the referenced record. If it loads in a form and has a table name in the URL starting with "ar_..." then the record is archived. You will want to re-think your archive rules, as having live records referencing archived records will sometimes cause performance problems.

Article Information

Last Updated:2019-01-11 06:56:33
Published:2018-06-29