- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 02:03 AM
Hello everyone,
First let me say that i am fairly new to servicenow only been working for a few months with it. I work in a team of four people which handle internal customers requests. Currently we have no assignment or business rules so we manually assign new tickets to each-other, which i would say is time consuming and frustrating if we have a lot of requests.
I now want to try and optimize the process of our team by creating a Round robin with business rules to handle requests. I will try to implement the approach which is shown on the video, which you probably all know: https://express.servicenow.com/support/videos/servicenow-express-use-case-round-robin-assignments/
The problem is i do not know how i can bypass the problem if a member of the team is currently on vacation or sick leave, i would like in that case the ticket to go directly to the next in line. Is there a way that the user can make himself offline or inactive for the period and he is automatically taken off the rotation? This way just setting additional Business rule for that. I searched the web for a while but couldn't find a fitting solution. If you know of any other approach which can be used, different from the one on the video please share.
Thank you in advance, i will really appreciate any help i can get on this one, it will certainly make our work a lot easier!
Thank you in advance and best regards
Mihail
Solved! Go to Solution.
- Labels:
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 12:34 AM
If you want to involve more planning on this, e.g. planned vacation or training in the future. You can also use the user schedule (there is a field called "schedule" on the sys_user table) to determine there availability. Then in your business rule you can check if the user is available at the current time using the "isInSchedule" function in the GlideSchedule API: GlideSchedule - Scoped
This is a bit more complicated, but it provides more flexibility around planning and forecast. You have to manage the user schedule of course for this.
Let me know if you need more explanation on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 12:34 AM
If you want to involve more planning on this, e.g. planned vacation or training in the future. You can also use the user schedule (there is a field called "schedule" on the sys_user table) to determine there availability. Then in your business rule you can check if the user is available at the current time using the "isInSchedule" function in the GlideSchedule API: GlideSchedule - Scoped
This is a bit more complicated, but it provides more flexibility around planning and forecast. You have to manage the user schedule of course for this.
Let me know if you need more explanation on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2018 07:37 AM
Hi everyone,
thank very much for your suggestions and ideas. All of them were great, i like Sebastian's answer the most. I will use all of your comments when talking to my company's support team and try to implement the best solution.
Wish you all a great weekend ahead!
Cheers,
Mihail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2018 10:38 PM
Hi,
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.
--------------------------
Script could be write into Business rule or Client callable Script Include.
Script Include:
function roundRobin() {
var tech_arr = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', current.assignment_group);
gr.query();
while(gr.next()) {
var isAssignable = gr.user.active;
var technician = gr.user + "";
var lastAssigned = gr.user.u_last_assigned_date_time+ "";
if (isAssignable == true) {
tech_arr.push({ sys_id: technician, last_assigned: lastAssigned });
}
}
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.
}
// gs.addInfoMessage(current.assigned_to);
function updateDateTime(assigned) {
//gs.addInfoMessage("Entering update date time...");
var nowDate = gs.nowDateTime();
var updateDate = new GlideRecord('sys_user');
updateDate.addQuery('sys_id', assigned);
updateDate.query();
while(updateDate.next()) {
updateDate.u_last_assigned_date_time = nowDate;
updateDate.update();
}
}
}
Thanks,
Nikhil Dixit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2019 04:30 PM
It worked very well. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2020 10:03 PM
HI Nikhil,
I have used the above mentioned script in my business rule, but it is not working. Could you please help me here,
onBefore business rule,
function roundRobin() {
var tech_arr = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', current.assignment_group);
gr.query();
while(gr.next()) {
var isAssignable = gr.user.active;
var technician = gr.user + "";
var lastAssigned = gr.user.u_last_ticket_assigned+ "";
if (isAssignable == true) {
tech_arr.push({ sys_id: technician, last_assigned: lastAssigned });
}
}
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.
}
// gs.addInfoMessage(current.assigned_to);
function updateDateTime(assigned) {
//gs.addInfoMessage("Entering update date time...");
var nowDate = gs.nowDateTime();
var updateDate = new GlideRecord('sys_user');
updateDate.addQuery('sys_id', assigned);
updateDate.query();
while(updateDate.next()) {
updateDate.u_last_assigned_date_time = nowDate;
updateDate.update();
}
}