CMDB Identification and Reconciliation rules | Triggering CMDB IRE ServiceNow from script | Part 2

Опубликовано: 30 Март 2026
на канале: ServiceNow Universe
6,252
147

CMDB Identification and Reconciliation rules | CMDB IRE ServiceNow | Triggering CMDB Identification and reconciliation rules from script

Informative video on very important concept that is IRE. IRE makes sure the CMDB data is clean and have no bad data. This is part 2 video of the video in link below:
Part 1 video link:
   • CMDB Identification and Reconciliation rul...  

--------------------------------------------------
Transform script to invoke IRE:
--------------------------------------------------
The below script should be added in the onBefore transform script to trigger IRE from transform maps.

Script:
(function runTransformScript(source, map, log, target) {
// Call CMDB API to do Identification and Reconciliation of current row
var cmdbUtil = new CMDBTransformUtil();
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);

----------------------------------------------------------------------------------------------------------------------
IdentificationEngine API can be used in scoped apps to create/update CIs
----------------------------------------------------------------------------------------------------------------------
Documentation link:
https://docs.servicenow.com/bundle/sa...

Sample code:
var payload = {
"items": [
{
"className": "cmdb_ci_win_server",
"values": {
"short_description": "Linux server description",
"name": "Linux Server 1"
}
}
]
};

var input = JSON.stringify(payload);
var output = sn_cmdb.IdentificationEngine.createOrUpdateCI('ServiceNow', input);

gs.info(JSON.stringify(output));

------------------------------------------------------------------------------------------------------
IdentificationEngineScriptableApi API can be used in global app
------------------------------------------------------------------------------------------------------
Documentation link:
https://docs.servicenow.com/en-US/bun...

Sample code:
var payload = {
"items": [
{
"className": "cmdb_ci_win_server",
"values": {
"short_description": "Linux server description",
"name": "Linux Server 1"
}
}
]
};
var input = new JSON().encode(payload);
var output = SNC.IdentificationEngineScriptableApi.createOrUpdateCI('ServiceNow', input);
gs.print(JSON.strinify(output));


#servicenow #servicenowdeveloper #servicenowimplementation #servicenowadmin #servicenowcommunity #servicenowcertification #cmdb