← All articles
◈ Tech & ServiceNowServiceNowCMDBScripting

How to Apply IRE to Import Sets

Posted on 27 Mar 2021 · 2 min read

Using import sets to populate the CMDB is always a challenging activity. Setting up the right coalesce field on your transform map is particularly tricky — correctly identifying the CI's primary attribute is key to avoiding duplicate records.

The Identification and Reconciliation Engine (IRE) framework provides a JavaScript API that can be used with import sets. By using the CMDBTransformUtil class, you don't need to set a coalesce field in your transform map at all. The class uses the Identification Rules that already exist in your instance to determine the primary key for each import.

Example Scenario

Imagine you want to import the following Windows Server records:

| Name | Serial Number | OS | |---|---|---| | Server-0090-HP | XXXXXXX0000-1 | Windows 2012 | | Server-0091-HP | (blank) | Windows 2012 |

Without IRE and CMDBTransformUtil, you would struggle to decide on a single coalesce key because different records have different available attributes. With IRE, you don't need to worry about that.

Steps to Implement

1. Verify that Identification Rules are configured for Windows Server. Out-of-the-box identification rules are already configured for most CI classes.

2. Create your Import Set and Transform Map targeting the correct server class. Make sure all Coalesce fields are set to false.

3. Create an OnBefore transform script with the following code:

var cmdbUtilIRE = new CMDBTransformUtil();
cmdbUtilIRE.setDataSource('ImportSet');
cmdbUtilIRE.identifyAndReconcileEnhanced(source, map, log);
ignore = true;

if (cmdbUtilIRE.hasError()) {
    var errorMessage = cmdbUtilIRE.getError();
    log.error(errorMessage);
} else {
    log.info('IRE Output Payload: ' + cmdbUtilIRE.getOutputPayload());
    log.info('Imported CI: ' + cmdbUtilIRE.getOutputRecordSysId());
}

Setting ignore = true tells the transform engine to skip its own insert/update logic — IRE handles the record creation and reconciliation entirely.

Why This Is Better

The traditional coalesce approach puts the responsibility of deduplication on you. IRE puts it where it belongs: in a consistent, rule-driven framework that applies the same logic regardless of which import tool you use. The result is a cleaner, more reliable CMDB.