Error MessageInvalid 'Access Control' record even though the selected outside table 'Case' is allowed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2022 11:00 PM
Hello Everyone,
I am getting this error "Invalid 'Access Control' record even though the selected outside table 'Case' is allowed. A table level Access Control on an outside table cannot contain a condition or script. Only roles are allowed"
Below is the script. Can anyone help with this?
var Contact = gs.getUserID();
var grVenCon = new GlideRecord('customer_contact');
grVenCon.addQuery('sys_id', Contact);
grVenCon.query();
grVenCon.next();
var venId = grVenCon.account;
var grVenProd = new GlideRecord('u_cmdb_model_solution_provider_product');
grVenProd.addQuery('u_solution_provider_id', grVenCon.account);
grVenProd.query();
var grCases = new GlideRecord('sn_customerservice_case');
grCases.addQuery('u_customer_facing_flag', true);
grCases.addQuery('u_asset.u_solution_provider_product.u_solution_provider_id', grVenCon.account);
grCases.query();
while (grCases.next()) {
answer = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2022 11:39 PM
Hey,
Try below code
answer = checkContact();
function checkContact(){
var Contact = gs.getUserID();
var venId;
var grVenCon = new GlideRecord('customer_contact');
grVenCon.addQuery('sys_id', Contact);
grVenCon.query();
if(grVenCon.next()){
venId = grVenCon.getvalue("account");
}
var grVenProd = new GlideRecord('u_cmdb_model_solution_provider_product');
grVenProd.addQuery('u_solution_provider_id', venId );
grVenProd.query();
if(grVenProd.next()){
var grCases = new GlideRecord('sn_customerservice_case');
grCases.addQuery('u_customer_facing_flag', true);
grCases.addQuery('u_asset.u_solution_provider_product.u_solution_provider_id',
venId);
grCases.query();
if(grCases.next()) {
return true;
}
}
return false;
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2022 12:06 AM
Hello Aman,
Thanks for your input.
I tried your code but still same error "Invalid 'Access Control' record even though the selected outside table 'DI case' is allowed. A table level Access Control on an outside table cannot contain a condition or script. Only roles are allowed."
Thanks,
Mahesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2022 12:09 AM
Hi,
update as this and test
var Contact = gs.getUserID();
var grVenCon = new GlideRecord('customer_contact');
grVenCon.addQuery('sys_id', Contact);
grVenCon.query();
grVenCon.next();
var venId = grVenCon.account;
var grVenProd = new GlideRecord('u_cmdb_model_solution_provider_product');
grVenProd.addQuery('u_solution_provider_id', venId);
grVenProd.query();
if(grVenProd.next()){
var grCases = new GlideRecord('sn_customerservice_case');
grCases.addQuery('u_customer_facing_flag', true);
grCases.addQuery('u_asset.u_solution_provider_product.u_solution_provider_id', venId);
grCases.query();
answer = grCases.hasNext();
}
else{
answer = false;
}
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-29-2022 11:15 AM
Hello Ankur,
I tried your code but still same error "Invalid 'Access Control' record even though the selected outside table 'DI case' is allowed. A table level Access Control on an outside table cannot contain a condition or script. Only roles are allowed."
Thanks,
Mahesh.