Round-Robin (Auto Assignment of new incidents and tasks)

magoo
Kilo Expert

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!

1 ACCEPTED SOLUTION

justin_drysdale
Mega Guru

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.


View solution in original post

102 REPLIES 102

I'll get something together.   We don't use the On Call, but I'll cobble together how we did it.



Thanks!
Cal


Whatever information If you could share, that'd be great!



Thanks heaps in advance!!



Regards,


Samiul


I put a flag on User that the Service Desk agents can turn off if they need to but it's mostly managed by a Scheduled job that looks at the Schedule table to see if the person is within this schedule.   I then use part of an old lab to write to a table for who was the person that has not been assigned a ticket in the longest time. So it's 2 fold.


  1. Person must be On Shift which is dictated by the user record having the Available for Autoassign flag set (just a true.false flag added to user)
  2. The schedules are just the System Scheduler>Schedules: schedules.png
  3. The service desk triage agent does this manually, it could be automated, but somethings get assigned out differently, so they wanted the option. I just added a check box for them . How to auto assign round robin.png
  4. The manager can set the schedule by person on the Group members table (I had to give them a role to modify) and also add the field from the Lab I used.   Send me an email and I'll send you the PDF.   But the field was Last Task Assigned: group mem schedules.png
  5. then the Scheduled job runs every 30 mins and checks the table and the schedule for if these are true and adds someone to the proper shift time so the Last assigned happens. I'm doing it really inefficient, but this gives you the idea:  

//first shift


var schedRec = new GlideRecord('cmn_schedule');


schedRec.get('name', 'M-F 9am-4pm IT Service Desk');


//get the specific schedule for Service Desk Shift


var sched = new GlideSchedule(schedRec.sys_id);


var now = new GlideDateTime();


if (sched.isInSchedule(now)) {


  //see if it's in schedule "NOW" and set those users that have a Schedule on their User record that matches the one queried. If it is "NOW", set the Auto Assign flag on user to True


  var gr = new GlideRecord('sys_user');


  gr.addQuery('active=true^u_available_for_ticket_assignm=true^schedule=81b226e52bb325004c71dc0e59da15b9^');


  gr.query();


  while(gr.next()) {


  gr.setValue('u_on_shift', 'true');


  gr.update();


  }



That's it in a very small nutshell.   If you send me your email, I'll forward the lab to you.



Thanks!


Cal


Hi ,

Can you please forward to sonali.panda@integrhythm.com.

 

Thanks

Sonali

Hello Justin,

 

Buddy you are simply brillient It just workd super perfect for me. I see that you have posted it before 5 years but Knoledge is never old.:):):)

 

Thanks a lot,

 

Keep up the good work,

BR,

Harsha Vardhan Reddy