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.

Evaluate Current Logged in User in ACL

Nic Omaha
Tera Guru

Hello I am trying to write a acl where the Current logged in user can only read the records if their department has a district code of "FLO". The field would be user.department.u_district. How can I evaluate if that is true in a ACL?

1 REPLY 1

Aman Kumar S
Kilo Patron

Hi @Nic Omaha 

you can have advanced checkbox as true on the Read ACL for the table.

and you can write script as below:

 

answer = checkDept();

function checkDept(){

    var grUser = new GlideRecord("sys_user");

   if( grUser.get(gs.getUserID()){

           if(grUser.department.u_district == "FLO"){

                   return true;
           }

       }
      return false;

}

 

Best Regards
Aman Kumar