Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Error MessageInvalid 'Access Control' record even though the selected outside table 'Case' is allowed

Mahesh44
Kilo Expert

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;
 }
9 REPLIES 9

Aman Kumar S
Kilo Patron

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 🙂

Best Regards
Aman Kumar

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.

Ankur Bawiskar
Tera Patron
Tera Patron

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

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

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.