Script not running in native UI
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I have written an onChange client script on server_name variable which is a list collector variable. This script is working in portal, but not in native UI
In native UI even the alert is not coming
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}
// Get first selected server from list collector
var firstServer = newValue.split(',')[0];
alert("firest"+firstServer);
var ga = new GlideAjax('Coned_fetch_server_details');
ga.addParam('sysparm_name', 'getServerDetails');
ga.addParam('sysparm_sys_id', firstServer);
ga.getXMLAnswer(function(answer) {
alert("Answer = [" + answer + "]");
if (answer == 'Ansible') {
g_form.setValue('task_for_automation', 'Yes');
} else {
g_form.setValue('task_for_automation', 'No');
}
});
}
The script include is
var Coned_fetch_server_details = Class.create();
Coned_fetch_server_details.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getServerDetails: function() {
var serverId = this.getParameter('sysparm_sys_id');
gs.info('Server Id = ' + serverId);
var gr = new GlideRecord('cmdb_ci_server');
if (gr.get(serverId)) {
gs.info('Build Source = ' + gr.u_build_source);
return gr.u_build_source.toString();
}
return '';
},
type: 'Coned_fetch_server_details'
});
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
It is not working, tried to add alert statement as well , the alert is also not coming