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.

Unable to add script to the ACL

Tuan Pro1
Tera Contributor

Hi all,

 

I have a requirement to restrict writing on a field when the currently logged-in user does not have BOTH A and B roles.

The table has the application scope as 'Global' but the field has the application scope as 'NVT'. Also, there is another table using this field.

 

I have created an ACL with application scope as 'NVT' and written a script:

answer = gs.hasRole('A') && gs.hasRole('B') ? true : false;

 

but when saving then appear error messages:

Error 1: Invalid 'Access Control' record even though the selected outside table 'Computer' is allowed. A field level Access Control on an outside table cannot contain script. Only roles and conditions are allowed.

Error 2: Invalid update
 

 

I would like to ask if is there a way to solve this error or if is there any other idea/solution to implement this.

Appreciate all of the help.

1 ACCEPTED SOLUTION

Hi @Tuan Pro1,

As per my understanding, the table and its fields should be in same application scope.

 

Thanks,

Sagar Pagar

The world works with ServiceNow

View solution in original post

3 REPLIES 3

Sagar Pagar
Tera Patron

Hi @Tuan Pro1,

Try ACL by creating in Global scope.

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Hi @Sagar Pagar ,

I've tried and got the error message

"Invalid 'Access Control' record even though the selected table is in the current application. A field level Access Control cannot protect an outside field. The field is in application 'NVT', but the current application is 'Global'."

Hi @Tuan Pro1,

As per my understanding, the table and its fields should be in same application scope.

 

Thanks,

Sagar Pagar

The world works with ServiceNow