The IdentificationEngine API uses the Identification and Reconciliation framework to minimize the creation of duplicate configuration items (CIs) and to reconcile CI attributes by only accepting information from authorized data sources when updating the Configuration Management Database (CMDB).

When using this class in a scoped application, use the sn_cmdb namespace identifier.

IdentificationEngine - createOrUpdateCI(String source, String input)

Inserts or updates configuration items (CI) and non-Configuration Management Database (CMDB) CIs (classes not extending from cmdb_ci) in the CMDB based on identification and reconciliation rules. Use this API instead of updating the CMDB directly.

For additional information on non-CMDB table ingestion, see IRE support for non-CMDB tables.

Example

The following shows how to reclassify a configuration item.

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(JSON.parse(output), null, 2));

Output:

{
  "items": [
    {
      "className": "cmdb_ci_linux_server",
      "operation": "NO_CHANGE",
      "sysId": "440577800f321010150efc91ff767e94",
      "identifierEntrySysId": "556eb250c3400200d8d4bea192d3ae92",
      "identificationAttempts": [
        {
          "attributes": [],
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "serial_number",
            "serial_number_type"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "searchOnTable": "cmdb_serial_number",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "serial_number"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "name"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "MATCHED",
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        }
      ],
      "info": [
        {
          "message": "CI Reclassification not allowed from class: [cmdb_ci_linux_server] to [cmdb_ci_win_server] by a reclassification restriction rule",
          "code": "SKIPPED_CLASS_SWITCH",
          "ruleSysId": "b3d4b3800f321010150efc91ff767eab"
        }
      ],
      "errorCount": 0,
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ],
      "mergedPayloadIds": []
    }
  ],
  "additionalCommittedItems": [],
  "relations": [],
  "additionalCommittedRelations": []
}

Example

The following shows how to update a configuration item.

var payload = {
"items": [
{
 "className": "cmdb_ci_win_server", 
 "values": {
   "chassis_type": "Desktop",
   "os": "Windows 2012 R2 Datacenter",
   "name": "Windows2012Server1",
   "serial_number": "0000-0011-1690-8730-8636-5722-52",
   "cpu_count": "1"
  },
  "lookup": [
  {
     "values": {
       "valid": "true",
       "serial_number": "0000-0011-1690-8730-8636-5722-52",
       "serial_number_type": "bios"
      },
     "className": "cmdb_serial_number"
   },
   {
     "values": {
       "valid": "true",
       "serial_number": "3311-9736-4988-9744-1749-4183-41",
       "serial_number_type": "chassis"
      },
     "className": "cmdb_serial_number"
   }],

    "internal_id": "16777219",
    "sys_object_source_info": {
      "source_feed": "SN Discovery Feed 1",
      "source_name": "ServiceNow",
      "source_native_key": "16777219",
      "source_recency_timestamp": "2019-10-18 08:31:23"
   }},
   {  
   "className": "cmdb_ci_spkg",
   "values": {
     "name": "Windows 2012 R2 Datacenter",
     "key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL"
     },

  "related": [
    {
      "internal_id": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219",
      "values": {
        "name": "Windows 2012 R2 Datacenter-SAMLABVM52"
      },
      "className": "cmdb_software_instance",
      "sys_object_source_info": {
        "source_feed": "SN Discovery Feed 1",
        "source_name": "ServiceNow",
        "source_native_key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219"
  }}]}, 
  {
  "className": "cmdb_ci_app_server_tomcat",
  "values": {
    "running_process_key_parameters": "/opt/OV/nonOV/tomcat/b/temp org.apache.catalina.startup.Bootstrap start",
    "install_directory": "/opt/OV/nonOV/tomcat/b",
    "name": "Tomcat@hpom9:3443",
    "server_port": "8006",
    "sys_class_name": "cmdb_ci_app_server_tomcat"
  },

  "internal_id": "tomcat_id"
  }],

"relations": [
  {
    "parent_id": "tomcat_id",
    "child_id": "16777219",
    "type": "Runs on::Runs"
  }],

"referenceItems": [
  {
    "referenceField": "installed_on",
    "referenced": "16777219",
    "referencedBy": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219"
  }]};

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

gs.info(JSON.stringify(JSON.parse(output), null, 2));

Output:

{
  "items": [
    {
      "className": "cmdb_ci_win_server",
      "operation": "INSERT",
      "sysId": "d56ab6eadbd510102f67dfea5e96194e",
      "relatedSysIds": [
        "dd6af62adb1910102f67dfea5e96197f",
        "996af62adb1910102f67dfea5e961980"
      ],
      "relatedItems": [
        {
          "errors": [],
          "operation": "INSERT",
          "errorCount": 0,
          "mergedPayloadIds": [],
          "warningCount": 0,
          "sysId": "dd6af62adb1910102f67dfea5e96197f",
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 0,
              "subIndex": 0
            }
          ],
          "className": "cmdb_serial_number"
        },
        {
          "errors": [],
          "operation": "INSERT",
          "errorCount": 0,
          "mergedPayloadIds": [],
          "warningCount": 0,
          "sysId": "996af62adb1910102f67dfea5e961980",
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 0,
              "subIndex": 1
            }
          ],
          "className": "cmdb_serial_number"
        }
      ],
      "identifierEntrySysId": "Unknown",
      "identificationAttempts": [
        {
          "info": "sys_object_source NO_MATCH",
          "identifierName": "",
          "attemptResult": "NO_MATCH",
          "attributes": [],
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "serial_number",
            "serial_number_type"
          ],
          "searchOnTable": "cmdb_serial_number",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "serial_number"
          ],
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "name"
          ],
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "attributes": [
            "mac_address",
            "name"
          ],
          "searchOnTable": "cmdb_ci_network_adapter",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ]
    },
    {
      "className": "cmdb_ci_spkg",
      "operation": "INSERT",
      "sysId": "116af62adb1910102f67dfea5e961981",
      "relatedSysIds": [
        "6d6af62adb1910102f67dfea5e961984"
      ],
      "relatedItems": [
        {
          "errors": [],
          "operation": "INSERT",
          "errorCount": 0,
          "mergedPayloadIds": [],
          "warningCount": 0,
          "sysId": "6d6af62adb1910102f67dfea5e961984",
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 1,
              "subIndex": 0
            }
          ],
          "className": "cmdb_software_instance"
        }
      ],
      "identifierEntrySysId": "Unknown",
      "identificationAttempts": [
        {
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "attributes": [],
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Software",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "key"
          ],
          "searchOnTable": "cmdb_ci_spkg",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        1
      ]
    },
    {
      "className": "cmdb_ci_app_server_tomcat",
      "operation": "INSERT",
      "sysId": "e96af62adb1910102f67dfea5e961985",
      "identifierEntrySysId": "Unknown",
      "identificationAttempts": [
        {
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "attributes": [],
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        2
      ]
    }
  ],
  "additionalCommittedItems": [],
  "relations": [
    {
      "className": "cmdb_rel_ci",
      "operation": "INSERT",
      "sysId": "e96af62adb1910102f67dfea5e961989",
      "identifierEntrySysId": "Unknown",
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ]
    }
  ],
  "additionalCommittedRelations": []
}

Example

Identify a dependent CI.

var payload = 
              {items: [ 
                    {className:'cmdb_ci_web_server', 
                     values: {name:'apache linux den 200', 
                              running_process_command: 'xyz',  
                              running_process_key_parameters: 'abc', 
                              tcp_port:'3452'}}, 
                    {className:'cmdb_ci_linux_server', 
                     values: {name:'lnux100', ram:'2048'}}],
               relations:[{parent: 0, child: 1, type: 'Runs on::Runs'}]
              };

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

gs.info(JSON.stringify(JSON.parse(output), null, 2));

Output:

{
  "items": [
    {
      "className": "cmdb_ci_web_server",
      "operation": "INSERT",
      "sysId": "b9bb766adb1910102f67dfea5e961962",
      "identifierEntrySysId": "Unknown",
      "identificationAttempts": [
        {
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "attributes": [],
          "hybridEntryCiAttributes": []
        },
        {
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "attributes": [],
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ]
    },
    {
      "className": "cmdb_ci_linux_server",
      "operation": "INSERT",
      "sysId": "a5bb766adb1910102f67dfea5e96195b",
      "identifierEntrySysId": "Unknown",
      "identificationAttempts": [
        {
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "attributes": [],
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "attributes": [
            "serial_number",
            "serial_number_type"
          ],
          "searchOnTable": "cmdb_serial_number",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "attributes": [
            "serial_number"
          ],
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "name"
          ],
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "attributes": [
            "mac_address",
            "name"
          ],
          "searchOnTable": "cmdb_ci_network_adapter",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        1
      ]
    }
  ],
  "additionalCommittedItems": [],
  "relations": [
    {
      "className": "cmdb_rel_ci",
      "operation": "INSERT",
      "sysId": "fdbb766adb1910102f67dfea5e961964",
      "identifierEntrySysId": "Unknown",
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ]
    }
  ],
  "additionalCommittedRelations": []
}

Example

Identify an independent CI with lookup-based identification.

var payload = {items: [
           {className:'cmdb_ci_netgear', 
               values: {name:'ny8500-nbxs08',
                        ports:'1200'}, 
               lookup: [{className:'cmdb_serial_number',
                            values:{serial_number:'1234ABCD', serial_number_type:'uuid',absent:'false',valid:'true'}},
                        {className:'cmdb_serial_number',
                            values:{serial_number:'3456EFGH', serial_number_type:'system',absent:'false',valid:'true'}}]}]};

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

gs.info(JSON.stringify(JSON.parse(output), null, 2));

Output:

{
  "items": [
    {
      "className": "cmdb_ci_netgear",
      "operation": "INSERT",
      "sysId": "787c7e6adb1910102f67dfea5e96196e",
      "relatedSysIds": [
        "f47c7e6adb1910102f67dfea5e961977",
        "3c7c7e6adb1910102f67dfea5e961977"
      ],
      "relatedItems": [
        {
          "errors": [],
          "operation": "INSERT",
          "errorCount": 0,
          "mergedPayloadIds": [],
          "warningCount": 0,
          "sysId": "f47c7e6adb1910102f67dfea5e961977",
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 0,
              "subIndex": 0
            }
          ],
          "className": "cmdb_serial_number"
        },
        {
          "errors": [],
          "operation": "INSERT",
          "errorCount": 0,
          "mergedPayloadIds": [],
          "warningCount": 0,
          "sysId": "3c7c7e6adb1910102f67dfea5e961977",
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 0,
              "subIndex": 1
            }
          ],
          "className": "cmdb_serial_number"
        }
      ],
      "identifierEntrySysId": "Unknown",
      "identificationAttempts": [
        {
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "attributes": [],
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "serial_number",
            "serial_number_type"
          ],
          "searchOnTable": "cmdb_serial_number",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "attributes": [
            "serial_number"
          ],
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "attributes": [
            "name"
          ],
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "attributes": [
            "mac_address",
            "name"
          ],
          "searchOnTable": "cmdb_ci_network_adapter",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "mergedPayloadIds": [],
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ]
    }
  ],
  "additionalCommittedItems": [],
  "relations": [],
  "additionalCommittedRelations": []
}

IdentificationEngine - createOrUpdateCIEnhanced(String source, String input, Object options)

Inserts or updates configuration items (CI) and non-Configuration Management Database (CMDB) CIs (classes not extending from cmdb_ci) in the CMDB based on identification and reconciliation rules. Use this API instead of updating the CMDB directly.

In addition to providing the functionality of the createOrUpdateCI() method, this method also supports:
  • Handling partial payloads
  • Handling partial commits
  • Removing duplicate items within a payload
  • Generating output summaries
For additional information on IRE and more detailed explanations of the data used by this method, see Identification and Reconciliation (IRE).

For additional information on non-CMDB table ingestion, see IRE support for non-CMDB tables.

Example

This example shows how to import multiple CI entries.

var payload = {
"items": [
{
 "className": "cmdb_ci_win_server", 
 "values": {
   "chassis_type": "Desktop",
   "os": "Windows 2012 R2 Datacenter",
   "name": "Windows2012Server1",
   "serial_number": "0000-0011-1690-8730-8636-5722-52",
   "cpu_count": "1"
  },
  "lookup": [
  {
     "values": {
       "valid": "true",
       "serial_number": "0000-0011-1690-8730-8636-5722-52",
       "serial_number_type": "bios"
      },
     "className": "cmdb_serial_number"
   },
   {
     "values": {
       "valid": "true",
       "serial_number": "3311-9736-4988-9744-1749-4183-41",
       "serial_number_type": "chassis"
      },
     "className": "cmdb_serial_number"
   }],

    "internal_id": "16777219",
    "sys_object_source_info": {
      "source_feed": "SN Discovery Feed 1",
      "source_name": "ServiceNow",
      "source_native_key": "16777219",
      "source_recency_timestamp": "2019-10-18 08:31:23"
   }},
   {  
   "className": "cmdb_ci_spkg",
   "values": {
     "name": "Windows 2012 R2 Datacenter",
     "key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL"
     },

  "related": [
    {
      "internal_id": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219",
      "values": {
        "name": "Windows 2012 R2 Datacenter-SAMLABVM52"
      },
      "className": "cmdb_software_instance",
      "sys_object_source_info": {
        "source_feed": "SN Discovery Feed 1",
        "source_name": "ServiceNow",
        "source_native_key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219"
  }}], 
  "settings" : {
        "skipReclassificationRestrictionRules" : "false",
        "updateWithoutDowngrade" : "true",
        "updateWithoutUpgrade" : "true",
        "updateWithoutSwitch" : "true"
      }}, 
  {
  "className": "cmdb_ci_app_server_tomcat",
  "values": {
    "running_process_key_parameters": "/opt/OV/nonOV/tomcat/b/temp org.apache.catalina.startup.Bootstrap start",
    "install_directory": "/opt/OV/nonOV/tomcat/b",
    "name": "Tomcat@hpom9:3443",
    "server_port": "8006",
    "sys_class_name": "cmdb_ci_app_server_tomcat"
  },

  "internal_id": "tomcat_id"
  }],

"relations": [
  {
    "parent_id": "tomcat_id",
    "child_id": "16777219",
    "type": "Runs on::Runs"
  }],

"referenceItems": [
  {
    "referenceField": "installed_on",
    "referenced": "16777219",
    "referencedBy": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219"
  }]};

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

gs.info(JSON.stringify(JSON.parse(output), null, 2));

Output:

{

"items": [
{
  "className": "cmdb_ci_win_server",
  "operation": "NO_CHANGE",
  "sysId": "65d873d2b3a0001028f6eae2c6a8dc2a",
  "relatedSysIds": [
    "a1d873d2b3a0001028f6eae2c6a8dc32",
    "a1d873d2b3a0001028f6eae2c6a8dc33"
],

"relatedItems": [
{
  "className": "cmdb_serial_number",
  "sysId": "a1d873d2b3a0001028f6eae2c6a8dc32",
  "markers": [],
  "inputIndices": [
  {
    "mainIndex": 0,
    "subIndex": 0
  }]
},
  "className": "cmdb_serial_number",
  "sysId": "a1d873d2b3a0001028f6eae2c6a8dc33",
  "markers": [],
  "inputIndices": [
  {
    "mainIndex": 0,
    "subIndex": 1
  }]
}],

"additionalRelatedItems": [],
"identificationAttempts": [],
"errorCount": 0,
"inputIndices": [0]
},
{
"className": "cmdb_ci_spkg",
"operation": "NO_CHANGE",
"sysId": "c764e971b320001028f6eae2c6a8dc44",

"relatedSysIds": [
  "8b64e971b320001028f6eae2c6a8dc47"
],
"relatedItems": [
  {
  "className": "cmdb_software_instance",
  "sysId": "8b64e971b320001028f6eae2c6a8dc47",
  "markers": [],
  "inputIndices": [
    {
      "mainIndex": 1,
      "subIndex": 0
    }]
  }],

"additionalRelatedItems": [],
"identifierEntrySysId": "a52a87c03746220006b216a543990e8c",
"identificationAttempts": [
  {
    "attributes": [
      "key"
     ],
    "identifierName": "Software",
    "attemptResult": "MATCHED",
    "searchOnTable": "cmdb_ci_spkg",
    "hybridEntryCiAttributes": []
  }],

"errorCount": 0,
"inputIndices": [1]
},

{
"className": "cmdb_ci_app_server_tomcat",
"operation": "INSERT",
"sysId": "6f29f3d2b3a0001028f6eae2c6a8dcc6",
"identifierEntrySysId": "Unknown",
"identificationAttempts": [
{
  "attributes": [
    "install_directory",
    "running_process_key_parameters",
    "sys_class_name"
  ],
"identifierName": "Tomcat",
"attemptResult": "NO_MATCH",
"searchOnTable": "cmdb_ci_app_server_tomcat",
"hybridEntryCiAttributes": []
},
{
"attributes": [
  "cl_port",
  "sys_class_name"
],
"identifierName": "Application Rule",
"attemptResult": "SKIPPED",
"searchOnTable": "cmdb_ci_appl",
"hybridEntryCiAttributes": []
},
{
"attributes": [
  "running_process_command",
  "running_process_key_parameters",
  "sys_class_name"
],
"identifierName": "Application Rule",
"attemptResult": "NO_MATCH",
"searchOnTable": "cmdb_ci_appl",
"hybridEntryCiAttributes": []
}
],

"errorCount": 0,
"inputIndices": [2]
}
],
"additionalCommittedItems": [],
"relations": [
{
  "className": "cmdb_rel_ci",
  "operation": "INSERT",
  "sysId": "6729f3d2b3a0001028f6eae2c6a8dcc9",
  "errorCount": 0,
  "inputIndices": [0]
}],
"additionalCommittedRelations": []
}

IdentificationEngine - identifyCI(String jsonString)

Determines the operation (insert/update) to perform with the specified payload without committing the operation in the database.

This works just like createOrUpdateCI(), but does not commit the result.

Table 5. Parameters
Name Type Description
jsonString String A JSON formatted string of configuration items to be added or updated. Each input string is in the format  'items: [{}], relations:[{}]', where each item within the items and relations lists contains name-value pairs.
The possible name-value pairs within the items list are:
  • className - Sys_class_name of the CI to be created or updated.
  • values:{} - Field information for the CI as name-value pairs, where the name is the field name.
  • lookup:[{}] - List of records with each item having name-value pairs like the items list.
The possible name-value pairs within the relations list are:
  • parent - Index of the parent item in the dependency relation
  • child - Index of the child item in the dependency relation
  • type - Relationship type. This is one of the name field values from the cmdb_rel_type table.
Table 6. Returns
Type Description
String A JSON formatted string that is a list of results. Each result string is in the format  'items: [{}], relations:[{}]', where each item within the items and relations lists contains name-value pairs.
The possible name-value pairs within the items list are:
  • className - Sys_class_name for the CI that was updated or created.
  • operation - Operation to perform, which is one of the following:
    • DELETE
    • INSERT
    • UPDATE
    • UPDATE_WITH_DOWNGRADE
    • UPDATE_WITH_SWITCH
    • UPDATE_WITH_UPGRADE
  • sysId - Sys_id of the CI that was updated or created.
  • relatedSysIds - List of sys_id values of CIs used during lookup based identification.
  • identifierEntrySysId - Sys_id of identifier entry used during matching.
  • errors - List of errors in the format of (error, message string)
  • duplicateIndices - List of indexes of items that are duplicates of the current item.
  • identificationAttempts - List of attempts in the format of (attributes, identiferName, attemptResult, searchOnTable) where
    • attributes - Attributes of identifier entry used during identification
    • identiferName - CI identifier to which this identifier entry belongs
    • attemptResult - One of SKIPPED, NO_MATCH, MATCHED, MULTI_MATCH
    • searchOnTable - Table searched during the identification process.
The possible name-value pairs within the relations list are:
  • className - Relationship CI's class name and is always cmdb_rel_ci
  • operation - Type of operation: INSERT, UPDATE, NO_CHANGE
  • sysId - Sys_id of the relationship CI inserted or updated

Example

The following shows how to reclassify a configuration item.

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.identifyCI(input);

gs.info(JSON.stringify(JSON.parse(output), null, 2));

Output:

{
  "items": [
    {
      "className": "cmdb_ci_linux_server",
      "operation": "NO_CHANGE",
      "sysId": "440577800f321010150efc91ff767e94",
      "identifierEntrySysId": "556eb250c3400200d8d4bea192d3ae92",
      "identificationAttempts": [
        {
          "attributes": [],
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "serial_number",
            "serial_number_type"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "searchOnTable": "cmdb_serial_number",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "serial_number"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "name"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "MATCHED",
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        }
      ],
      "info": [
        {
          "message": "CI Reclassification not allowed from class: [cmdb_ci_linux_server] to [cmdb_ci_win_server] by a reclassification restriction rule",
          "code": "SKIPPED_CLASS_SWITCH",
          "ruleSysId": "b3d4b3800f321010150efc91ff767eab"
        }
      ],
      "errorCount": 0,
      "warningCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ],
      "mergedPayloadIds": []
    }
  ],
  "additionalCommittedItems": [],
  "relations": [],
  "additionalCommittedRelations": []
}

IdentificationEngine - identifyCIEnhanced(String source, String input, Object options)

Determines the Configuration Management Database (CMDB) operation (insert/update) to perform with the specified payload (request body), without committing the operations in the database.

Use this method to simulate submission of a payload.

This method is similar to the IdentificationEngine - identifyCI(String jsonString) method, however it also supports the following functionality:
  • Partial payloads
    • In case of an item having a warning or error, indicates if an item operation is INSERT_AS_PARTIAL or INSERT_INCOMPLETE.
    • Returns the sys_ids of partial payloads that were merged with existing partial payloads.
  • Supports payload deduplicate feature.
  • Generates a summary.

Example

var payload = {
"items": [
{
"className": "cmdb_ci_win_server",
"values": {
   "chassis_type": "Desktop",
   "os": "Windows 2012 R2 Datacenter",
   "name": "Windows2012Server1",
   "serial_number": "0000-0011-1690-8730-8636-5722-52",
   "cpu_count": "1"
  },
  "lookup": [
  {
     "values": {
       "valid": "true",
       "serial_number": "0000-0011-1690-8730-8636-5722-52",
       "serial_number_type": "bios"
      },
     "className": "cmdb_serial_number"
   },
   {
     "values": {
       "valid": "true",
       "serial_number": "3311-9736-4988-9744-1749-4183-41",
       "serial_number_type": "chassis"
      },
     "className": "cmdb_serial_number"
   }],
 
    "internal_id": "16777219",
    "sys_object_source_info": {
      "source_feed": "SN Discovery Feed 1",
      "source_name": "ServiceNow",
      "source_native_key": "16777219",
      "source_recency_timestamp": "2019-10-18 08:31:23"
   }},
   {
   "className": "cmdb_ci_spkg",
   "values": {
     "name": "Windows 2012 R2 Datacenter",
     "key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL"
     },
 
  "related": [
    {
     "internal_id": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219",
      "values": {
        "name": "Windows 2012 R2 Datacenter-SAMLABVM52"
      },
      "className": "cmdb_software_instance",
      "sys_object_source_info": {
        "source_feed": "SN Discovery Feed 1",
        "source_name": "ServiceNow",
        "source_native_key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219"
  }},
  {
    "internal_id": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777229",
      "values": {
        "name": "Windows 2012 R2 Datacenter-SAMLABVM52"
      },
    "className": "cmdb_software_instance",
    "sys_object_source_info": {
      "source_feed": "SN Discovery Feed 1",
      "source_name": "ServiceNow",
      "source_native_key": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777229"
  }}
],
  "settings" : {
        "skipReclassificationRestrictionRules" : "false",
        "updateWithoutDowngrade" : "true",
        "updateWithoutUpgrade" : "true",
        "updateWithoutSwitch" : "true"
      }},
  {
  "className": "cmdb_ci_app_server_tomcat",
  "values": {
    "running_process_key_parameters": "/opt/OV/nonOV/tomcat/b/temp org.apache.catalina.startup.Bootstrap start",
    "install_directory": "/opt/OV/nonOV/tomcat/b",
    "name": "Tomcat@hpom9:3443",
    "server_port": "8006",
    "sys_class_name": "cmdb_ci_app_server_tomcat"
  },
 
  "internal_id": "tomcat_id"
  }],
 
"relations": [
  {
    "parent_id": "tomcat_id",
    "child_id": "16777219",
    "type": "Runs on::Runs"
  }],
 
"referenceItems": [
  {
    "referenceField": "installed_on",
    "referenced": "16777219",
    "referencedBy": "Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777219"
  }]};
 
var input = JSON.stringify(payload);
var output = sn_cmdb.IdentificationEngine.identifyCIEnhanced('ServiceNow', input, {});

gs.info(JSON.stringify(JSON.parse(output), null, 2));

Output:

{
  "items": [
    {
      "className": "cmdb_ci_win_server",
      "operation": "INSERT",
      "relatedSysIds": [
        null,
        null
      ],
      "relatedItems": [
        {
          "errors": [],
          "operation": "INSERT",
          "className": "cmdb_serial_number",
          "errorCount": 0,
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 0,
              "subIndex": 0
            }
          ],
          "mergedPayloadIds": [],
          "warningCount": 0
        },
        {
          "errors": [],
          "operation": "INSERT",
          "className": "cmdb_serial_number",
          "errorCount": 0,
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 0,
              "subIndex": 1
            }
          ],
          "mergedPayloadIds": [],
          "warningCount": 0
        }
      ],
      "identificationAttempts": [
        {
          "attributes": [],
          "info": "sys_object_source NO_MATCH",
          "identifierName": "",
          "attemptResult": "NO_MATCH",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "serial_number",
            "serial_number_type"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "searchOnTable": "cmdb_serial_number",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "serial_number"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "name"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "NO_MATCH",
          "searchOnTable": "cmdb_ci_hardware",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "mac_address",
            "name"
          ],
          "identifierName": "Hardware Rule",
          "attemptResult": "SKIPPED",
          "searchOnTable": "cmdb_ci_network_adapter",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ],
      "mergedPayloadIds": [],
      "warningCount": 0
    },
    {
      "className": "cmdb_ci_spkg",
      "operation": "INSERT",
      "relatedSysIds": [
        null
      ],
      "relatedItems": [
        {
          "errors": [],
          "operation": "INSERT",
          "className": "cmdb_software_instance",
          "errorCount": 0,
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 1,
              "subIndex": 0
            }
          ],
          "mergedPayloadIds": [],
          "warningCount": 0
        },
        {
          "errors": [],
          "warnings": [
            {
              "error": "MISSING_MATCHING_ATTRIBUTES",
              "message": "In payload missing minimum set of input values for criterion (matching) attributes from identify rule for table [cmdb_software_instance]. Add these input values in payload item '{\"className\":\"cmdb_software_instance\",\"values\":{},\"internal_id\":\"f7273cccec30101056cd4bb46eb4db5d\",\"sys_object_source_info\":{\"source_feed\":\"SN Discovery Feed 1\",\"source_name\":\"ServiceNow\",\"source_native_key\":\"Microsoft Windows Server 2012 R2 Datacenter_:::_NULL|16777229\"},\"settings\":{},\"sys_ire_info\":{\"ire_received_time\":\"2020-05-10 17:57:48\"}}'"
            }
          ],
          "operation": "INSERT_AS_PARTIAL",
          "className": "cmdb_software_instance",
          "errorCount": 0,
          "sysId": "Unknown",
          "markers": [],
          "inputIndices": [
            {
              "mainIndex": 1,
              "subIndex": 1
            }
          ],
          "mergedPayloadIds": [],
          "warningCount": 1
        }
      ],
      "identificationAttempts": [
        {
          "attributes": [],
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "hybridEntryCiAttributes": []
        },
        {
          "attributes": [
            "key"
          ],
          "identifierName": "Software",
          "attemptResult": "NO_MATCH",
          "searchOnTable": "cmdb_ci_spkg",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "markers": [],
      "inputIndices": [
        1
      ],
      "mergedPayloadIds": [],
      "warningCount": 0
    },
    {
      "className": "cmdb_ci_app_server_tomcat",
      "operation": "INSERT",
      "identificationAttempts": [
        {
          "attributes": [],
          "info": "sys_object_source SKIPPED",
          "identifierName": "",
          "attemptResult": "SKIPPED",
          "hybridEntryCiAttributes": []
        }
      ],
      "errorCount": 0,
      "markers": [],
      "inputIndices": [
        2
      ],
      "mergedPayloadIds": [],
      "warningCount": 0
    }
  ],
  "additionalCommittedItems": [],
  "relations": [
    {
      "className": "cmdb_rel_ci",
      "operation": "INSERT",
      "errorCount": 0,
      "markers": [],
      "inputIndices": [
        0
      ],
      "mergedPayloadIds": [],
      "warningCount": 0
    }
  ],
  "additionalCommittedRelations": []
}  

IdentificationEngine - runIdentificationAudit(GlideRecord now_GR)

Runs an identification audit against the specified configuration item (CI) to detect duplicates.

If duplicates are found, duplication tasks are created. Only use this method on CI types with independent identification rules.

Table 9. Parameters
Name Type Description
now_GR GlideRecord CI on which to run the audit to detect duplicates. The CI must have independent identification rules.
Table 10. Returns
Type Description
void

Example

The following example shows how to check a record in the Linux Servers [cmdb_ci_linux_server] table for duplicates.

var sysId = '<cbdb_ci_sys_id>';
var gr = new GlideRecord('cmdb_ci_linux_server');
gr.get(sysId);
sn_cmdb.IdentificationEngine.runIdentificationAudit(gr);