- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2014 04:25 AM
HI All,
I was asked to create a round-robin type approach (Auto Assignment) for any incidents/tasks that come into our two level1 groups. What we are looking for is that if its sent to team A's group it will auto assign to the next team member in line, and same with Team B. I have searched the forums and found a post back from 2008 but it had been deleted by ServiceNow in 2010. Our company is new to ServiceNow (a couple months now), and I am guessing this is more of a script that would need to run, but currently do not have much experience in scripting. Has anyone had any luck with doing something like this? Any suggestions would be greatly appreciated!
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2014 03:07 PM
We have this in our instance. Here's the breakdown:
On sys_user, create a date/time field to track last ticket assigned. Also create a checkbox that will be used to determine if the user can receive a ticket. This can be your vacation exclusion logic.
1. Make an array (associative, key-value) to contain your users that will receive tickets and their corresponding last ticket assigned timestamp.
2. Find your assignment group, and query it's users.
3. Push those users and timestamp into the user array from 1. You can conditionalize here with the checkbox to make sure you are only pushing 'active' users into the array.
4. Sort the array by timestamp, return the user that has the oldest timestamp.
4.5. Update the user's timestamp.
5. assigned_to = returned user.
Please let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 02:30 PM
It looks like I forgot to change the variable name...
Replace any/all instances of 'userList' with 'tech_arr' and it should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 03:14 PM
Awesome, that was it, Thank you so much for your quick response and for answering my post!
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014 07:30 PM
Did anyone figure this out for dublin? I need to move my group from a pick it up queue to a round robin assignment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2014 04:00 AM
Eric,
We are personally on Calgary at the moment, But Justin was able to help me out with the following and its been super helpful for our support, not sure why it wouldn't work on Dublin for you, but test none the less. As noted in the script you will need to create a new checkbox field on the user record as well as a field to note last assigned time
Table: TASK
on Insert and Update
Condition: current.assignment_group.name == "Group Name Here" && current.assigned_to == ""
Script:
gs.sleep(3000);//sleep statement added to prevent ticket flood being assigned to a single technician.
current.assigned_to = resolveTech();
function resolveTech() {
var tech_arr = [],
group = new GlideRecord('sys_user_grmember');
group.addQuery('group', 'Group Sys ID here');//replace with your assignment group sys_id.
group.query();
while(group.next()) {
var isAssignable = group.user.u_assign_sd_tickets,//isAssignable is a checkbox on sys_user.
//true = user can receive tickets using this business rule
technician = group.user + "",
lastAssigned = group.user.u_last_ticket_assigned + "";
if (isAssignable == true) {//only pushing assignable users to array
tech_arr.push( { sys_id: technician /*name: group.user.name*/ /*Not using name now, was logging tech name during testing*/, last_assigned: lastAssigned } );
}
}
//sort on last assigned, return user with
tech_arr.sort(function(a, b) {
return a.last_assigned<b.last_assigned?-1:a.last_assigned>b.last_assigned?1:0;});
updateDateTime(tech_arr[0].sys_id); //updating ticket last assigned date
return tech_arr[0].sys_id;//assigned_to technician.
}
function updateDateTime(assigned) {
var nowdt = gs.nowDateTime();
var updateDate = new GlideRecord('sys_user');
updateDate.addQuery('sys_id', assigned);
updateDate.query();
while(updateDate.next()) {
updateDate.u_last_ticket_assigned = nowdt;
updateDate.update();
}
}
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2014 01:42 PM
Justin,
Could you provide more details as to how the checkbox (to determine availability for tickets) functions?
Does this business rule only run during business hours, and thus the checkbox only needs to be unchecked if users are on vacation? Or does the rule run constantly and users check/uncheck the box as their availability changes?
Thanks!