Building round robin algorithm in ServiceNow Incident module
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2025 01:59 PM
Hi Everyone,
I'm working on a requirement to implement a round-robin algorithm in the ServiceNow incident module. The goal is to assign tickets to group members in a round-robin fashion when the group's type is set to 'round-robin'.
Here's the approach I've taken so far:
1) Created a Checkbox field: Added a 'roundrobin' checkbox field in the 'sys_user_grmember' table to enable/disable round-robin assignment.
2) Added a Date/Time field: Introduced a 'roundrobindate' field to track assignment times.
Logic:
When an incident is assigned to a group, a business rule sorts the group members who have the 'roundrobin' checkbox checked. It then sorts these members by the 'roundrobindate' field in ascending order, identifying the member who was assigned a ticket the earliest. The ticket is then assigned to this member.
Has anyone implemented something similar or have suggestions to improve this approach?
Note: I am calling a script include (logic) from my business rule. Sharing the code here for reference.
Thanks in advance!
Code
setAssignedToTwo: function(assGrp) {
let grMem = new GlideRecord('sys_user_grmember');
grMem.addEncodedQuery("group=" + assGrp + "^u_grp_mem_round_robin=true");
grMem.orderBy('u_grp_mem_rr_date');
grMem.query();
if (grMem.next()) {
current.assigned_to = grMem.user.sys_id;
current.update();
grMem.u_grp_mem_rr_date = gs.nowDateTime();
grMem.update();
}
},

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2025 04:32 PM
Have you looked at using Advanced Work Assignment rather than this customisation?