Exclude specific person from a group approval

t_a_rogers
Kilo Expert

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

1 ACCEPTED SOLUTION

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'));


}


View solution in original post

17 REPLIES 17

Abhinay Erra
Giga Sage

Empty the groups which says ${assignment_group} and you should be good to go.


If i could send you a gift basket I would.. LOL. Thanks for the help!!


Hello,



first of all, all the best in the New Year. I am quite interested in this topic as well, but the script is doing nothing for me, Still, the approval is requested from all members. You have advised to "Empty the groups which says ${assignment_group} " but not sure how you meant it. How I should empty my assignment group?



Thank you


Andrej


Hi Andrej, happy new year!



Make sure your approval activity in the workflow is a USER approval activity, not a GROUP approval. Then, when filing out the approval activity, you'll see a "users" and "groups" input fields. Leave those blank. Instead, use JUST the script to call out which group will get the approval.



(If you scroll to the right on the screenshot above, you'll see that Groups field)


Abhinay Erra
Giga Sage

LOL. Glad you got your question answered.