"Access to Script Include--- blocked from scope---" error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:06 AM
//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'
});
//Client Scripts
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if ( newValue === '') {
return;
}
var ga = new GlideAjax('x_opepo_servicehub.getCourseDetails');
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);
}
}
I've created client script and script include in a scoped application named "Servicehub". Also,I've made the script include accessible from All application scopes.On changing the value of the field "Course Code",I'm getting the error :-
Access to Script Include x_opepo_servicehub.getCourseDetails blocked from scope: x_opepo_servicehub
Please tell me how to fix this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:21 AM
Script Include name is: GetCourseDetails_6
Not just: GetCourseDetails
Please check appropriate spelling/formatting for this line:
var ga = new GlideAjax('x_opepo_servicehub.getCourseDetails');
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:27 AM
Thank You for the response.I fixed that.However,now I'm getting another error which is:-
"onChange script error: ReferenceError: global is not defined function () { [native code] }"
Please help with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 07:53 AM
Hello,
Looks like you have created script include in Global scope , can you check that again ? Also make sure 'Client callable' is check and lastly if issue still persist, create cross scope entry or application caller access entry
https://docs.servicenow.com/bundle/paris-application-development/page/build/applications/reference/c_CrossScopePrivilegeRecord.html
https://docs.servicenow.com/bundle/sandiego-application-development/page/build/applications/task/scope-resource-access.html
Regards
Regards,
Musab