Exclude user from group approval

IndianaJones
Tera Expert

I am trying to create a way for an incident to be reviewed by a peer on the team before it can be resolved. I went with the out of the box group approval, but the issue is that the person requesting the approval (the person assigned to work the ticket) is also part of the group that has to approve the request. So then they get a approval request for their own approval, which makes them able to approve their own approval request. I'd assume ServiceNow had an easy way to not include the person in the group approval if they were part of the team. Anyone know of a quick way to do this?

1 ACCEPTED SOLUTION

Hi Rocky,

please check updated script

you were querying with group.name but giving sys_id so updated code below

answer = [];

var gr= new GlideRecord('sys_user_grmember');
gr.addQuery('group', current.assignment_group);

var isMember = gs.getUser().getUserByID(current.assigned_to).isMemberOf(current.assignment_group);

if(isMember == true){
gr.addQuery('user','!=',current.assigned_to);
}

gr.query();
while(gr.next()){
answer.push(gr.getValue('user'));
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

13 REPLIES 13

Ankur,

 

Since this workflow is on RITM table, I hvae modified.

even though the approval is triggering to selected person which should not

find_real_file.png

Hi,

I believe the question is asked by another user.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi ANkur,

My self only got posted . some one provided your link . So based on that link i approched you:)

COuld you please help here

Hi,

Didn't understand

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader