onChange script error: ReferenceError: global is not defined function () { [native code] }
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:34 AM
//client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if ( newValue === '') {
return;
}
var ga = new GlideAjax(global.GetCourseDetails_6);
ga.addParam('sysparam_name', 'getCourse');
ga.addParam('sysparam_course_code', g_form.getValue('course_code'));
ga.getXML(callback);
function callback(response)
{
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('name_of_course',answer);
}
}
//script include
var GetCourseDetails_6 = Class.create();
GetCourseDetails_6.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getCourse:function(server_side_data) {
var cc;
var courseID = this.getParameter('sysparam_course'); // getting value from client side
gs.info("jhcourse" + courseID);
var cn = new GlideRecord('x_opepo_courseware_course'); //Gliding to Course table to get Course Code
cn.addEncodedQuery('sys_id='+courseID); //matching condition table record sys_id with client_side
cn.query();
if (cn.next()) {
cc=cn.getValue('course_name');
}
return cc;
},
type: 'GetCourseDetails_6'
});
I'm getting the following error.Please help me fix this.
Labels:
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:38 AM
Hi Lokesh,
When calling the script include it needs to be in quotation marks
var ga = new GlideAjax('global.GetCourseDetails_6');
Hope this helps,
Shane
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:46 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2022 08:29 AM
In Script Include, there's a field "Accessible from". Please select it as 'All application scopes' if not done. It should resolve the issue.
Hope it helps.