- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2017 06:07 AM
Hello all,
This Community is huge and I'm a bit lost but in my Company we work with servicenow and we are a resolver team.
We receive many tickets daily and someone have to be taking care and assigning the tickets to someone. Does anybody knows if Servicenow has an option that every time that we get a ticket it gets assigned to someone from our team automatically?
If we are 20, first ticket to the 1st, second to the 2 º and like this forever and ever...
If someone can help me to get any information related to this topic I would be very grateful
Kind regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 03:07 AM
Hi Dante,
Yes, you can achieve it using a business rule.
Firstly create the fields in sys_user:
1.create a date/time field to track last ticket assigned.
2.Also create a checkbox that will be used to determine if the user can receive a ticket.
Business rule:
Condition: current.assignment_group.name == "Group Name Here" && current.assigned_to == ""
on Insert and update
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();
}
Hope this might be helpful.
If the reply was informational, please like, mark as helpful or mark as correct!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 03:07 AM
Hi Dante,
Yes, you can achieve it using a business rule.
Firstly create the fields in sys_user:
1.create a date/time field to track last ticket assigned.
2.Also create a checkbox that will be used to determine if the user can receive a ticket.
Business rule:
Condition: current.assignment_group.name == "Group Name Here" && current.assigned_to == ""
on Insert and update
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();
}
Hope this might be helpful.
If the reply was informational, please like, mark as helpful or mark as correct!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 03:15 AM
thank you very much! this information is very helpful for me.