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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2019 12:58 AM
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2019 01:03 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2019 02:12 AM
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??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2019 02:48 AM
I don't think you can get to child groups without a query