ScopeAccessNotGrantedException

Ramkumar Thanga
Mega Sage

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)

7 REPLIES 7

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Can you paste the code you are writing.?

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Ramkumar Thanga
Mega Sage

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);

Hi,

which table name you are using there?

var gr = new GlideRecord("tableName");

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ramkumar Thanga
Mega Sage

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