Calling Identification and Reconciliation API from a scoped app
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 08:11 AM
I have a need to call the Identification and Reconciliation API from a scoped app.
We have installed the Flexera integration into ServiceNow. The Flexera integration is a scoped app. As delivered the integration makes use of a conventional Import Set that coalesces on Serial Number.
I need to rather make the import set work via the Identification and Reconciliation engine.
I have written an onBefore Transform Script for the Import Set:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('Flexera');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;
})(source, map, log, target);
But it fails when I try to run. Error is: "java.lang.SecurityException: CMDBTransformUtil undefined, maybe missing global qualifier"
The following article refers to a plugin that can be used to allow a scoped app in scripts to use the prefix 'sn_cmdb.IdentificationEngine.<method>' to access identification engine APIs.
Activate Configuration Management For Scoped Apps (CMDB)
But there is not much other detail on how to use change my script after enabling the plugin.
Anybody out there able to share their experience/knowledge on this matter?
Much appreciated
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 08:55 AM
Further to above, I have tried:
var cmdbUtil = sn_cmdb.IdentificationEngine.CMDBTransformUtil();
cmdbUtil.setDataSource('Flexera');
cmdbUtil.identifyAndReconcile(source, map, log);
I get error:
Cannot find function CMDBTransformUtil in object function IdentificationEngine()
This makes sense because according to IdentificationEngine - Scoped , the CMDBTransformUtil method is not part of the Identification Engine Scope API.
So I guess my question still is:
How to I call Identification and Reconciliation engine from an Import Set that is in a scoped app?
Regards
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 09:19 AM
You can try switching over to the global scope and creating a new script include (ex: globalCmdbHelper) and make it accessible from all application scopes.
Script would look like this:
var globalCmdbHelper = Class.create();
globalCmdbHelper.prototype = {
initialize: function() {
},
identifyAndReconcile: function(){
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('Flexera');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;
},
type: 'globalCmdbHelper'
};
Then in your transform script, call the script include.
new global.globalCmdbHelper().identifyAndReconcile();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 09:37 AM
Thanks Benn23,
I was thinking of doing something like that.
Will give it a go and share the outcome.
Regards
Martin