Got: The undefined value has no properties. executing sn_cmdb.IdentificationEngineScriptableApi.createOrUpdateCI

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 03:07 AM
Hi,
I've got this error:
org.mozilla.javascript.EcmaError: The undefined value has no properties.
Caused by error in <refname> at line 1
when executing:
sn_cmdb.IdentificationEngineScriptableApi.createOrUpdateCI
the code is:
function injectScopedAssetsIntoGlobalUsingReconciliation() {
var injectFunction = function(grElement){
gs.info('injectFunction ');
var payload = {
'items': [{
'className': 'cmdb_ci_computer',
'value': {
'name': 'Win Server 100',
'ip_address': '10.20.30.40',
'mac_address': 'ABCD1234'
}
}]
};
var input = JSON.stringify(payload);
var output = sn_cmdb.IdentificationEngineScriptableApi.createOrUpdateCI(
'ServiceNow',
input);
gs.info('output ' + output);
};
injectFunction();
}
I'm trying to use reconciliation to add a row to the computer table.
I followed the documentation here.
The example here use SNC.IdentificationEngineScriptableApi.createOrUpdateCI but using SNC object I've got:
org.mozilla.javascript.EcmaError: "SNC" is not defined.
Caused by error in <refname> at line 1
I have the Configuration Management For Scoped Apps (CMDB) plugin active.
I'm running this script form my scoped app.
Any idea why?
Thank you!
- Labels:
-
Scoped App Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 08:05 AM
Just an update, running this code as global works:
gs.info('injectFunction ');
var payload = {
'items': [{
'className': 'cmdb_ci_computer',
'value': {
'name': 'Win Server 100',
'ip_address': '10.20.30.40',
'mac_address': 'ABCD1234'
}
}]
};
var input = JSON.stringify(payload);
var output = sn_cmdb.IdentificationEngineScriptableApi.createOrUpdateCI(
'ServiceNow',
input);
gs.info('output ' + output);
with SNC instead of sn_cmdb.
Running background script in the scoped app with sn_cmdb give the same error...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 11:13 PM
The problem was:
IdentificationEngineScriptableApi instead of IdentificationEngine, the first is for global scripts the second for scoped