Automatically assigning ticket to myself, if the ticket is not assigned to anybody
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2019 02:32 AM
Hi all,
I have a requirement such as, If the ticket is not assigned to anybody with in four hours based on created time then the ticket needs to be get auto assigned to myself.
For example, My assignment group name is service desk group and along with me in that group five members exist. Now ticket is assigned to my group on today. Now after four hours if the ticket is not assigned to any person in my group then it should auto assign to my name. This should be happen only for catalog task(sc_task) tickets.
please help me in this regard. Thank you in advance.
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2019 05:06 AM
Hello
In our case I have a custom Script Include and a scheduled job running every minute to assign in a round robin way the ticket without assigned_to technician.
The jobs configuration is:
You can create your own Script Include with your "logic" to achieve this requeriment
Please, mark correct, useful or bookmark if I helped you
Thanks
Ariel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2019 09:26 PM
HI Ariel,
Thanks for the response, can you please extend your help by suggesting me how to create script include based upon the requirement here? Kindly help. Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2019 12:45 AM
Hello
Yes, of course.
Mi script include script is this:
var GLOIncidentUtil = Class.create();
GLOIncidentUtil.prototype = {
initialize: function() {
},
/*
Query the incident table without assigned_to tech of the groupIN parameter
and assign one using round robin algoritm
*/
roundRobinTechIncident: function(groupIN)
{
//Incidents without assigned_to tech
var grINC = new GlideRecord("incident");
grINC.addQuery('assignment_group', groupIN);
grINC.addQuery('assigned_to','');
grINC.query();
//loop
while (grINC.next()) {
//Tech round robin pool
var group = new GlideRecord('sys_user_grmember');
group.addQuery('group', groupIN);
group.addQuery('user.u_round_robin_active',true);
group.orderBy('user.u_last_ticket_assigned');
group.query();
//Assigned Tech
if (group.next()) {
//Update round robin tech data
var nowdt = gs.nowDateTime();
var updateDate = new GlideRecord('sys_user');
updateDate.addQuery('sys_id', group.user);
updateDate.query();
while(updateDate.next())
{
updateDate.u_last_ticket_assigned = nowdt;
updateDate.update();
}
//Incident update
grINC.comments = 'Incidencia asignada de forma automática por ServiceNow al técnico: ' + group.user.name;
grINC.assigned_to = group.user;
grINC.u_round_robin_assigned = true;
grINC.update();
}
}
},
type: 'GLOIncidentUtil'
};
Ariel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2019 12:51 AM
Your script include must be similar to this
var GLOIncidentUtil = Class.create();
GLOIncidentUtil.prototype = {
initialize: function() {
},
/*
Query the incident table without assigned_to tech of the groupIN parameter
and assign one using round robin algoritm
*/
roundRobinTechIncident: function(groupIN)
{
//Incidents without assigned_to tech
var grINC = new GlideRecord("incident");
grINC.addQuery('assignment_group', groupIN);
grINC.addQuery('assigned_to','');
grINC.query();
//loop
while (grINC.next()) {
//Assign me
grINC.assigned_to = '<<YOUR-USER-SYS_ID>>'
grINC.update();
}
},
type: 'GLOIncidentUtil'
};
You must call your script include with the "Service Desk" SYS_ID
Ariel