
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 11:42 AM
In our Change workflow we have an initial approval by the assignment group. It's an OOB step called Technical Approvals. Our managers are not part of their groups. They have requested:
- That they (the managers) be part of the group
- That they have the ability to choose who on their teams can approve (they may not want the entire team to be an approver)
To facilitate this we added a true/false button to the user record called: u_change_assessment_approver
How can I tell the approval to look at the assignment group and send the approval request to only those users of that group who have u_change_assessment_approver marked true?
Additionally how can I have it also send that approval to the manager of that group?
Thanks all!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:52 PM
dooo sorry much easier.. this is in a change workflow right?? if so do this instead in a user approval script
- var answer = [];
- var counter = 0;
- var failsafe_sid = 'sid of change manager or whoever will approve if there are no active approvers';
- answer.push(current.assignment_group.manager.toString()); //this pushes the manager of the group to the approvers
- var users = new GlideRecord('sys_user_grmember');
- users.addQuery('group',current.assignment_group); //find members of the group
- users.addQuery('user.u_change_assessment_approver',true); //check to see if they are a change approver
- users.query();
- while(users.next()){
- answer.push(users.user.toString());
- if(users.user.active){
- counter++;
- }
- }
- if(counter == 0){answer.push(failsafe_sid)}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:18 PM
Hi Raymond,
Thanks for your response. What you wrote makes sense but it is well beyond my technical expertise to write that script. I have certainly run into the auto-approve behavior in because one of our groups did not populate correctly.
We need to query the members of the group chosen in the assignment_group (variable) field to see which of them has u_change_assessment_approver marked true on the user record . Then, we want add the assignment_group.manager as an approver as well.
I really appreciate the help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:39 PM
This will do it -
var answer = [];
var grusr = new GlideRecord('sys_user_grmember');
grusr.addQuery('group.name','PASS GROUP NAME HERE');
grusr.addQuery('user.u_change_assessment_approver',true);
grusr.query();
while(grusr.next()) {
answer.push(grusr.getValue('user'));
}
// Now add the manager
answer.push(current.assignment_group.manager);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2016 04:32 PM
Hi Chuck,
I am looking for a solution for the similar kind of requirement. RITM approval , Catalog task creation should get routed based on the multiple variable values selected by the user while submitting a catalog item.
EX: If an item is submitted with variable values like Urgency is 1, Priority is 2 then approval should be routed to group XYZ, Catalog task should be assigned to group ABC.
Likewise , if another item has Location variable as Europe, Urgency is 2 then approval should be routed to group DEF, Catalog task should be assigned to group 123.
I have created a custom table , added a condition field and made is as a dependent field on another field with type as table which points to the (sc_item_option) table , by this way we can build multiple conditions for the same catalog item but the problem is we are unable to compare the RITM variable values with the conditions stored on the custom table reason being.
Thanks,
Mathankumar R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:46 PM
ok shouldn't be to tough.. lets see if i can steal code from my compatriots...just keep in mind you are NOT putting the code in a GROUP approval but in a user approval.
- var answer = [];
- var counter = 0;
- var failsafe_sid = 'sid of change manager or whoever will approve if there are no active approvers';
- var group = new GlideRecord('sys_user_group');
- group.get(current.variables.assignment_group); //use the variable or however you are getting the assignment group here.
- answer.push(group.manager.toString()); //this pushes the manager of the group to the approvers
- var users = new GlideRecord('sys_user_grmember');
- users.addQuery('group',current.variables.assignment_group); //find members of the group
- users.addQuery('user.u_change_assessment_approver',true); //check to see if they are a change approver
- users.query();
- while(users.next()){
- answer.push(users.user.toString());
- if(users.user.active){
- counter++;
- }
- }
- if(counter == 0){answer.push(failsafe_sid)}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:52 PM
dooo sorry much easier.. this is in a change workflow right?? if so do this instead in a user approval script
- var answer = [];
- var counter = 0;
- var failsafe_sid = 'sid of change manager or whoever will approve if there are no active approvers';
- answer.push(current.assignment_group.manager.toString()); //this pushes the manager of the group to the approvers
- var users = new GlideRecord('sys_user_grmember');
- users.addQuery('group',current.assignment_group); //find members of the group
- users.addQuery('user.u_change_assessment_approver',true); //check to see if they are a change approver
- users.query();
- while(users.next()){
- answer.push(users.user.toString());
- if(users.user.active){
- counter++;
- }
- }
- if(counter == 0){answer.push(failsafe_sid)}