Script include returning "org.mozilla.javascript.NativeArray"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 12:43 AM
Hi Techies,
My requirement is to populate "database" variable , the values of this "database" variable are populate based on another variable "Landscape". So I wrote below onChange catalog client script and script include.
Script include returning something like "org.mozilla.javascript.NativeArray" . Please find below scripts and let me know what causing this issue.
Catalog Client Script:
function onChange(control, oldValue, newValue, isLoading) { var ga = new GlideAjax('ITSM_Database_oracle_choices'); function UpdateChoiceValues(response) { |
Script Include:
var ITSM_Database_oracle_choices = Class.create(); var land = this.getParameter('sysparm_land_name'); } type: 'ITSM_Database_oracle_choices' |
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 01:17 AM
Hi Dinesh,
I have made some changes in your scripts, please give it a try.
Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
var ga = new GlideAjax('ITSM_Database_oracle_choices');
ga.addParam('sysparm_name','getdatabase');
ga.addParam('sysparm_land_name',newValue);
ga.getXML(UpdateChoiceValues);
}
function UpdateChoiceValues(response) {
var strOption = [];
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer != null) {
strOption = answer.split(',');
g_form.clearOptions('database');
g_form.addOption('database', '', '-- None --');
for(var i=0;i<strOption.length;i++) {
g_form.addOption('database', strOption[i], strOption[i]);
}
}
}
Script Include:
var ITSM_Database_oracle_choices = Class.create();
ITSM_Database_oracle_choices.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getdatabase:function(){
var ar = [];
var land = this.getParameter('sysparm_land_name');
var c = new GlideRecord('u_catalog_approvals_and_routing');
c.addEncodedQuery('u_catalog_item=a267a495db63c01002e258eadc961943^u_catalog_item=a267a495db63c01002e258eadc961943^u_field_name=database');
c.addQuery('u_dependent', land);
c.query();
while(c.next())
{
var str = c.u_name.toString();
ar.push(str);
}
var answer = ar;
return answer;
},
type: 'ITSM_Database_oracle_choices'
});
Kindly mark my answer as Correct and Helpful based on the Impact.
Regards,
Alok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 01:45 AM
Hello Alok,
No luck with the above modified script.
Regards,
Dinesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 01:58 AM
try giving alert in client script and logs in Script include. Check what value is coming up
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 06:53 AM
I have tried all possible ways with the logs too, but no luck. Its returning the same array message