Getting org.mozilla.javascript.NativeArray@c9527e while auto populating

Jyothikala Adur
Kilo Contributor

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'
});

4 REPLIES 4

Vamsi Sreenivas
Tera Guru

Hi @Jyothikala Adurthi , in your script include replace "new Array()" with just "[]". So it will be:

var svcar = [];

 

Mark my answer as HELPFUL / CORRECT if this help resolve your issue.

Regards,

Vamsi S

Hi Vamsi,

I am getting error. I think code is not working. Can you suggest on the same

@Jyothikala Adurthi , did you replace "new Array()" with [] as mentioned in previous reply?

 

Can you also share the script include code for _addService() and _addParentServices() functions?

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