Yash Agrawal1
Tera Guru

Hello Guys,

Lets Suppose, You are Resolver and getting multiple Incidents/Issues daily and it is difficult for you to maintain the workload balance.

Also In your Organization there is no any procedure implemented to assign the coming  incidents/Issue to the members of the Selected assignment Group.

So, Here I have a Solution which is "Round Robin Method" to assign the Ticket  to a Resolver Automatically based on the Last Assigned Ticket Time.

Lets Start,

1. Create a Date/Time type of field on User('sys_user') table "Last Assigned Ticket Time".

2.Create a After-Insert Business Rule on Incident Table.

3.Condition - Assignment Group is not Empty.

Here is the Code.

(function executeRule(current, previous /*null when async*/) 
 {
   var grmem=new GlideRecord('sys_user_grmember');
   grmem.addQuery('group',current.assignment_group);
   grmem.orderBy('user.u_last_assigned_time');
   grmem.query();
   if(grmem.next())
   { 
	current.setValue('assigned_to',grmem.user);
	current.update();
	var gruser=new GlideRecord('sys_user');
        gruser.addQuery('sys_id',grmem.user);
	gruser.query();
	if(gruser.next())
	{
	  gruser.setValue('u_last_assigned_time',gs.nowDateTime());	
	  gruser.update();
	}
    }

})(current, previous);

Note- I implemented this Solution on my PDI, So if anyone is trying to implementing the same and faced any issue ,please let me know I would like to help them.

Also If you like the Content and Article, Please Like it and Bookmark it, which will encourage me to create more good article on new topics.

Thanks & Regards,

Yash K.Agrawal

Certifed Servicenow Developer

Comments
Hemant Kumar Ch
Kilo Sage

Hello @Yash Agrawal1 

 

This Solution is flooding Single Technician with Multiple Tickets 

 

Suppose we have Three users I want the ticket assignment should rotate 

 

User1 > User2 > User3 >User1

 

Can we enhance this code ?

Harini Dhanapal
Tera Contributor

Hello @Hemant Kumar Ch 
I'm looking for the same enhancement. Any leads?

Version history
Last update:
‎11-25-2021 06:14 AM
Updated by: