ACLs / Security rules should not have GlideRecord/GlideAggregate in script

Rohit Agarwal
Mega Expert

Hi,
I want to avoid database lookups in Access Control rules. Please check the below script. Can we update the code differently (without GlideRecord queries)?

see below script:

var check=false;
var gr=new GlideRecord("sys_user_group");
gr.addEncodedQuery("name=test1^ORparent=123xxxxx789^ORname=test2");
gr.query();
while(gr.next())
{
if(gs.getUser().isMemberOf(gr.sys_id))
{
check=true;
break;
}

}
answer=check;

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rohit,

What is your exact requirement?

Do you want to show records to the logged in user based on the group he/she belongs?

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur,

my require here is that i have the sysID of parent group. Now I want the all child group under that parent group without using gliderecord. is this possible??

I don't think you can get to child groups without a query