logo

NJP

How to ensure that IRE updates correct record when there are duplicates in CMDB

Import · Oct 16, 2022 · article

When there are duplicate records in CMDB for a given CI.

When a new data load is performed ServiceNow may not update the exact record you want.

Look at the duplicate CIs.

Identify the record that needs to be retained and records that needs to be retired since they are duplicates.

Change the identification attributes to values so that IRE wont identify them as valid record.

Rerun data load.

you will observe that in some cases IRE will update duplicate record.

sys_object_source table stores references to CIs that need to be updated for a given identification attribute.

When this happens it ties together the ID and CI reference (via sys_id).

In order to fix this issue there are two options

1. Delete records in sys_object_source that have target_sys_id as invalid.

2. Update sys_object_source records to have target_sys_id as reference to the record that you think is the valid record.

Sample script :

var counter = 0;var grOs = new GlideRecord('sys_object_source');var queryOs = 'target_sys_idINxxyyyzzzzzzzzzzz'; //sys_ids of bad records or duplicate records.grOs.addEncodedQuery(queryOs);//grDc.setLimit(1);grOs.query();while(grOs.next()) {counter++;grOs.deleteRecord();}

gs.print(counter);

View original source

https://www.servicenow.com/community/cmdb-articles/how-to-ensure-that-ire-updates-correct-record-when-there-are/ta-p/2353264