- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 08:30 AM
Hi All,
In our Change Management process we have 3 linear approvals:
1) Peer approval (Should be a team member double checking the work in the change request)
2) Manager approval (a team manager validating this should take place) - Sends to Assignment Group "Manager"
3) CAB approval
Right now step 1 sends a group approval request to all members of the Assignment Group. The issue with this is some groups have the Manager also as a team member, so the manager sees the peer approval request and tries to approve that. We tell them "Don't approve the peer approval if you're a manager" but they are confused.
SO: Is there a way to exclude a person from a group approval? Say, ServiceNow checks and sees you are a group manager and it skips sending you the approval request on the peer approval step?
I have no idea how to write this type of script, so your input would be helpful
Thanks,
Travis
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 09:10 AM
Here you go
answer = [];
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'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 09:05 AM
I see you! My issue is the inability to write advanced scripts. I agree, it sounds like what we need would go in that spot and would say something like if user = group.manager, don't generate that user's approval..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 09:10 AM
Here you go
answer = [];
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'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 09:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 10:09 PM
I have a similar requirement, where I am trying to exclude user submitting request, does the below code work for the same.
answer = [];
var gr= new GlideRecord('sys_user_grmember');
gr.addQuery('group',current.assignment_group);
gr.addQuery('user','!=',current.opened_by.user);
gr.query();
while(gr.next()){
answer.push(gr.getValue('user'));
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2020 05:46 AM
I don't see why not.