Applying CI Identification and Reconciliation to Import Sets
Summarize
Summary of Applying CI Identification and Reconciliation to Import Sets
This guide explains how to apply Configuration Item (CI) Identification and Reconciliation processes during Import Sets in ServiceNow CMDB to prevent duplicate CIs and maintain data integrity. Import Sets may cause duplicate CIs when importing identical records. Using the CMDBTransformUtil API in the transform map script helps identify and reconcile CIs before insertion, ensuring accurate and unique CMDB entries.
Show less
Key Features
- CI Identification and Reconciliation: The CMDBTransformUtil API is called in the
onBeforetransform script to invoke the identification engine, which checks each record for duplicates. - Duplicate Handling: If a record is not a duplicate, it is inserted; if it is a duplicate, the existing CI is updated with new data.
- Transform Map Script Example: The script includes setting the data source, calling
identifyAndReconcile, and usingignore = trueto prevent duplicate record creation. - Multiple Target Tables per Import Set: You can specify different target CMDB classes per record by adding a target table column in the data source and mapping it to the Class field in the transform map. This enables routing records to appropriate CI classes (e.g., Computer, Server) during import.
Practical Considerations and Restrictions
- Each import set must be associated with a single transform map when using the CMDBTransformUtil API.
- The API does not enforce mandatory field validation; imports will fail if mandatory fields are missing regardless of transform map settings.
- CI Identification and Reconciliation cannot be applied to import sets involving dependent CIs that use dependent identification rules.
Implementation Steps for ServiceNow Customers
- Add the CMDBTransformUtil API call in the
onBeforetransform script of your import set to enable CI identification and reconciliation. - Use
ignore = truein the script to prevent duplicate records from being created. - To support multiple CI classes in one import, add a target table column to your data source and map it to the Class field in the transform map.
- Ensure your import set is linked to only one transform map and verify mandatory fields are included to prevent import failures.
By following these steps, ServiceNow customers can efficiently manage CI imports, minimize duplicates, and keep their CMDB accurate and up to date.
You can apply CMDB Identification and Reconciliation processes when Import Sets are used to import CIs into the CMDB. CI identification can prevent duplicate CIs in the CMDB, which Import Sets might otherwise cause.
Populating CMDB tables using Import Sets can inadvertently result in duplicate CIs when multiple imported records are identical to an existing CI. To minimize this duplication, you can apply CMDB Identification and Reconciliation processes to Import Sets when importing new records into CMDB tables.
Transform map script
(function runTransformScript(source, map, log, target) {
// Call CMDB API to do Identification and Reconciliation of current row
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('ImportSet');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;
if (cmdbUtil.hasError()) {
var errorMessage = cmdbUtil.getError();
log.error(errorMessage);
} else {
log.info('IE Output Payload: ' + cmdbUtil.getOutputPayload());
log.info('Imported CI: ' + cmdbUtil.getOutputRecordSysId());
}
})(source, map, log, target);The ignore = true code phrase prevents Import Sets from creating the same
record again after it is processed by the identification engine.
Process
- If not duplicate: Inserts the record to the target table.
- If duplicate: Updates the existing CI in the CMDB, with data from the source record.
The CMDBTransformUtil API pre-processes the source data, then passes the input values to the identification engine with import set being the data source by default. The CMDBTransformUtil API supports a target field that is a reference field in the same manner that Import Sets supports it. The CMDBTransformUtil API also supports a source script, evaluating source scripts to determine the target value which is then passed to the identification engine. For more information, see Creating a field map.
Specify multiple target tables for an import set
You can configure each record in an import set with its own target table. Then, instead of inserting all the transformed records into a single target table, the records are inserted into the different target tables that are specified per record. For example, you might need to insert some records from the import set to the Computer class and other records to the Server class.
- In the data source file, add a target table column. Use a string such as "MyTable" to label the column header. In each record row, enter the target table for the record, as a valid CMDB class name such as "cmdb_ci_computer".
- After you Auto Map Matching Fields on the Table Transform Map form,
add a field map for the added target table column to establish a relationship between classes
and the target tables in the CMDB.
- In the Field Map related list on the Table Transform Map form, click New.
- Set Source field to the header of the target table column that you added in the data source file, such as MyTable.
- Set Target field to Class.
- Click Submit.
When you configure an import set with multiple target tables as described in the steps above, the Target table that is specified on the Table Transform Map form is not used.
Restrictions
- An import set should be associated with a single transform map. While adding a call to the CMDBTransformUtil API, ensure that still a single transform map exists for the import set.
- The CMDBTransformUtil API does not check if mandatory fields have values when used with Import Sets . Regardless of how enforce mandatory fields is set in the transform map, data import fails if a mandatory field does not have a value.
- CI Identification and Reconciliation cannot be applied to Import Sets for dependent CIs (CIs with dependent identification rules).