Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

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  ||  10x 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