- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 02:19 PM
We are trying to have a SLA where if the service desk incident is updated by some one other then the service desk it will start a two hour timer. The SLA would stop when the Service Desk updates the ticket or it is closed/transferred.\
The problem is updated by is a string. I have a script include that returns an array of all the service desk usernames, but it looks like the filter is reading the whole comma separated arraty, not each element as a different user name. Any ideas?
function getServiceDeskUserNames(){
var arrayUtil = new ArrayUtil();
var groupMembers = [];
var grGroupMembers = new GlideRecord('sys_user_grmember');
//get the service desk group
grGroupMembers.addQuery('group','9d4cb8b538494900a06b750aa778bbcc');
grGroupMembers.query();
while (grGroupMembers.next()) {
groupMembers.push(grGroupMembers.user.user_name.toString());
}
return arrayUtil.unique(groupMembers);
}
Solved! Go to Solution.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 05:56 PM
This is untested but you get the general idea... Just ensure you change lines 2 and 3 to match your environment and please mark the post as answered if this works out
function getServiceDeskUserNames() {
var user = current.sys_updated_by;
var groupName = "Service Desk";
//Get Users sys_id
var usrGr = new GlideRecord('sys_user');
if(usrGr.get('user_name', user) {
userID = usrGr.sys_id + '';
}
else {
//we didn't find the user return false
return false;
}
//get Group sys_id
var grpGr = new GlideRecord('sys_user_group');
if(grpGr.get('name', groupName)) {
groupID = grpGr.sys_id + '';
}
else {
//we didn't find the group return false
return false;
}
//Now see if they are a member of the group
var grpMbr = new GlideRecord('sys_user_grmember');
grpMbr.addQuery('user', userID);
grpMbr.addQuery('group', groupID);
gr.query();
if (gr.next()) {
return true;
}
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 07:19 PM
You may be able to use a combo of the 2 previous answers in one line:
gs.getUser().getUserByID(current.sys_updated_by).isMemberOf('Group Name')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2014 11:55 AM
I did have to change it a little. It did not like true or false being the return values, so I set the true return to be current.sys_updated_by.