Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Building round robin algorithm in ServiceNow Incident module

Gopi22
Tera Guru

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();
        }
    },

 

1 REPLY 1

Kieran Anson
Kilo Patron

Have you looked at using Advanced Work Assignment rather than this customisation?