- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 04:19 AM
How to exclude only three users from group approval in workflow. I am using Approval user activity.
Here is my script which is going for group.
var gr = new GlideRecord("sys_user_group");
gr.addQuery("parent", current.u_designated_cab);
gr.addQuery("type","CONTAINS",'6aa67778dbf40700e907572e5e9619cd');
gr.query();
if (gr.next()) {
answer = gr.sys_id.toString();
}
let me now how to filter out members from this group
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 05:17 AM
If your script is the best way to get to the group in question, that's fine for starters, then you would run this script inside the if block instead of your answer line. Otherwise, just use this script with a hard-coded group sys_id if it will always be the same
answer = [];
var mbr= new GlideRecord('sys_user_grmember');
mbr.addQuery('group', gr.sys_id.toString()); //or use following line instead
//mbr.addQuery('group', '1'); //replace 1 with sys_id of group
mbr.addQuery('user','NOT IN','1, 2, 3'); //replace 1, 2, 3 with sys_ids of users to exclude
mbr.query();
while(mbr.next()){
answer.push(mbr.user.toString());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 04:25 AM
Hi Kamer
You can check this example,This will give some clarity how to remove a member from the group
Please mark my answer correct and helpful ,if this helps you in any way
Thanks in advance
Saurabh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 04:43 AM
var gr= new GlideRecord('sys_user_grmember');
gr.addQuery('group',current.assignment_group);
gr.addQuery('user','!=',current.assignment_group.manager);
gr.query();
while(gr.next()){
answer.push(gr.getValue('user'));
}
try something like this.
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Pranav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 05:17 AM
If your script is the best way to get to the group in question, that's fine for starters, then you would run this script inside the if block instead of your answer line. Otherwise, just use this script with a hard-coded group sys_id if it will always be the same
answer = [];
var mbr= new GlideRecord('sys_user_grmember');
mbr.addQuery('group', gr.sys_id.toString()); //or use following line instead
//mbr.addQuery('group', '1'); //replace 1 with sys_id of group
mbr.addQuery('user','NOT IN','1, 2, 3'); //replace 1, 2, 3 with sys_ids of users to exclude
mbr.query();
while(mbr.next()){
answer.push(mbr.user.toString());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 05:40 AM
Hi Brad,
Thank You it works:)