Getting org.mozilla.javascript.NativeArray@c9527e while auto populating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 07:50 AM
Hi Team,
I have requirement to get auto populate application of server. I have two variable server, Application details. Application details needs to be populated based on server.
Server field referenced to cmdb_ci table.
I have written some script. but I am getting " org.mozilla.javascript.NativeArray@c9527e". Please help to get it work.
Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//var CI = g_form.getValue('server_name');
var ajax = new GlideAjax('getCIService');
ajax.addParam('sysparm_name','serviceAffectedByCI');
ajax.addParam('sysparm_user_name',newValue);
alert(newValue);
ajax.getXML(ServiceAffected);
function ServiceAffected(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('application_details',answer.toString());
alert(answer);
}
}
Script Include:
var getCIService = Class.create();
getCIService.prototype = Object.extendsObject(AbstractAjaxProcessor, {
serviceAffectedByCI: function() {
var ids = this.getParameter('sysparm_user_name');
var cis = new GlideRecord("cmdb_ci");
if (cis.get(ids)) {
if (cis.sys_class_name == "cmdb_ci_service")
this._addService(ids, this.services);
this._addParentServices(ids, this.services, this.currentDepth);
}
var svcar = new Array(); // services is an Object, convert to Array for final query
for (var i in this.services)
svcar.push(i);
return svcar; // list of affected services
},
type: 'getCIService'
});
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 09:44 AM
Hi
var svcar = [];
Mark my answer as HELPFUL / CORRECT if this help resolve your issue.
Regards,
Vamsi S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 10:07 AM
Hi Vamsi,
I am getting error. I think code is not working. Can you suggest on the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 07:49 PM
Can you also share the script include code for _addService() and _addParentServices() functions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 09:00 PM
Try putting logs to understand which part of the code is failing as we are not sure what your private functions does so cannot comment much