Notifications

351 views

Description

CMDBTransformUtil will pass an invalid sys_id value of "-1" through to the Identification engine in the payload, it it is included in the map of the transform.
Those values need to be ignored, or the transform will fail with error: createOrUpdateCI failed, and 'No record with sys_id [-1] exist in table'

This would be a common situation for an existing CMDB Import Transform Map being enhanced for the best practice of using the Identification and Reconciliation engine for the insert or update.

Steps to Reproduce

This example uses the existing out-of-box SCCM 2016 plugin, as an example of a Transform that isn't using the Identification and Reconciliation engine for the insert or update yet.

  1. Install the SCCM 2016 Integration plugin
  2. Add a onBefore script to the 'SCCM 2016 Computer Identity' Transform Map to make it use CMDBTransformUtil for the insert/update instead, using the example in the docs:
    Apply CI Identification and Reconciliation to Import Sets 
  3. Use REST API Explorer, and the Import Set API, to run the following payload for the SCCM 2016 Computer Identity :
    {
    "u_manufacturer": "Microsoft Corporation",
    "u_model": "Virtual Machine",
    "u_biosserialnumber": "PRB1331033-TEST",
    "u_name": "PRB1331033-TEST"
    }
  4. Look at the Transform History and the insert will not have happened, with error: createOrUpdateCI failed.
    Information:
    Identification and Reconciliation Result: {"items":[{"sysId":"Unknown","identifierEntrySysId":"Unknown","errors":[{"error":"INVALID_INPUT_DATA","message":"Found invalid sys_id in payload. No record with sys_id [-1] exist in table [cmdb_ci_computer] or is a duplicate record with [discovery_source] field marked as Duplicate"}],"identificationAttempts":[]}],"relations":[],"logContextId":"d96fa79bdb44730073a98324399619ab"}

Workaround

  1. Customise the "CMDBTransformUtil" Script Include getTransformValues function to ignore this invalid sys_id:

lines 117-118. Change from:

} else 
values[targetField] = targetValue;

Change to:

} else if (targetField !== 'sys_id' || targetValue !== '-1')
values[targetField] = targetValue;

Related Problem: PRB1331033

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:42:35
Published:2019-03-13