ScopeAccessNotGrantedException
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2022 02:28 AM
Hi!!!
I am configuring Skill Determination Rules for AWA, I am using the scripting section for a query purpose from a table which is under a application scope.
(CSM).
The scripting part doesn't got executed and throws the error into the logs. Can anyone suggest your ideas to fix this issue.
From system logs:
Root cause of JavaScriptException: com.glide.script.fencing.access.ScopeAccessNotGrantedException
: com.glide.script.fencing.access.ScopeAccessNotGrantedException: read access to "tableName" not granted: com.glide.script.fencing.ScopedGlideRecord.checkOperationPermitted(ScopedGlideRecord.java:245)
com.glide.script.fencing.ScopedGlideRecord.jsFunction_query(ScopedGlideRecord.java:182)
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2022 02:38 AM
Hello,
Can you paste the code you are writing.?
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2022 02:50 AM
hello Musab,
Thanks for the response!!
Here is the code.
var commodity = "";
var skills = [];
gs.info("Inside Script");
var poLine = current.u_po_line;
if(current.u_all_polines == "true"){
var gr = new GlideRecord("tableName");
gr.addQuery("purchase_order","current.u_po_number");
gr.addEncodedQuery('u_commodity_codeISNOTEMPTY');
gr.query();
if(gr.next()){
commodity = gr.u_commodity_code;
}
}
else{
gs.info("Inside PO Line");
var grline = new GlideRecord("table name");
grline.addQuery("sys_id","IN",poLine);
grline.addEncodedQuery('u_commodity_codeISNOTEMPTY');
grline.query();
if(grline.next()){
commodity = grline.u_commodity_code;
}
}
var commodities = gs.getProperty("sn_customerservice.propertyName");
gs.info("Inside Commodity"+ commodity);
if(commodities.includes(commodity)){
gs.info("Inside Skill setup");
var skill = {"skillName":"Skill Name", "skillSysId":"SysId", "mandatory":true};
skills.push(skill);
return skills;
}
return "";
})(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2022 03:08 AM
Hi,
which table name you are using there?
var gr = new GlideRecord("tableName");
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2022 03:28 AM
Hi Ankur,
Thanks for your reply.
Now it works for me.
tableName is a custom table.
I have created Cross scoped privilege record, which allows to access the table
Thanks!
Ram