- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 01:32 PM
I'm looking to add the name of an approver's approval group in a change request. We have a few groups approving and it's hard to keep track of who's approval is for what group. Is this a script or can it be done a simpler way? I'd also like to add this into a notification as well.
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2014 08:13 AM
you would need to add the 'assignment group' column from that group record, which is misleadingly a task record on the sysapproval_group table.
so group.assignment group is the actual group whom this users has approved on behalf of.
Marc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 01:46 PM
if you call this function with a user object it will return the first group found for the user...
function set_tam(var1){
//this function looks up the group the passed in user object belongs to
//var1 MUST be the user object not just the sid
var tam = new GlideRecord('sys_user_grmember');
tam.addQuery('user',var1.sys_id);
tam.query();
if (tam.next()){
//set the old group on the form
return tam.group;
}
}
if you have the SID and not the whole object use this one...
function set_tam(var1){
//this function looks up the group the passed in user sid
var tam = new GlideRecord('sys_user_grmember');
tam.addQuery('user',var1);
tam.query();
if (tam.next()){
//set the old group on the form
return tam.group;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 01:56 PM
If the user belongs to several groups, would I have a problem with this script? I'm going to assume I'd have to specify a list of groups to return instead of returning the first group the query finds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 01:59 PM
it depends on your goal... our policy is one and only one group per user.. so if they are in multiples they get the first one they are in...
if you want to list all groups they are in... define answer as an array in the function and change the if to a while... then instead of returning tam.group use answer.push(tam.group);... then after the while loop runs return answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 05:58 PM
Maybe I am misunderstanding your question, but out of the box there is an assignment group column on the Approvers related list that shows the group that the user is approving for. Is this what you are after? If there are multiple groups required to approve the record at the same time then you will see multiple groups show up in the list for the various members.