How to restrict catalog form to only particular groups using advanced script?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 01:01 PM
Hi,
How to restrict catalog form to only particular groups using advanced script in user criteria condition is like group contains developers?
Thanks
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 01:21 PM
Hi @SanjivMeher , Here is the script :
var list= new GlideRecord('sys_user_grmember');
list.addQuery('user', gs.getUserID());
list.addQuery('group.active', true);
list.addEncodedQuery('group.nameLIKEdevelopers');
list.query();
while(list.next()){
answer = true;
}
{
answer = false;
}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 03:28 PM
Can you try below script
var glist= new GlideRecord('sys_user_grmember');
glist.addQuery('user', gs.getUserID());
glist.addQuery('group.active', true);
glist.addEncodedQuery('group.nameLIKEdevelopers');
glist.query();
if (glist.next()){
answer = true;
}
else{
answer = false;
}
Please mark this response as correct or helpful if it assisted you with your question.