ServiceNow Advanced Reference Qualifier | How to filter the Assignment group based on Assigned To

Been in a predicament in ServiceNow, where you know the person a task needs to be assigned to, but don’t know the right group? I got you!

In this video, we add an advanced reference qualifier on a dictionary override on the assignment group fields (for incidents) that calls a server side script include to run some funky glideRecord queries and return as back a refined list of group sys_id’s. Its then these groups that are shown when you click the Assignment Group magnifying glass.

Reference Qualifier bit:

javascript:new global.AssignmentGroupFilter().refineAssignmentGroup(current.assigned_to)

Script Include:

var AssignmentGroupFilter = Class.create();
AssignmentGroupFilter.prototype = {

        initialize: function() {},

        refineAssignmentGroup: function(assigned_to) {
            var groupsArray = [];

            //return all relevant groups (active, itil) if the assigned_to value is empty
            if (gs.nil(assigned_to)) {
                var groups = new GlideRecord("sys_user_group");

                if (groups.hasNext) {
                    while ( {

				}else {

                    //sys_user_grmember has the user to group relationship
                    var grpMember = new GlideRecord("sys_user_grmember");
                    grpMember.addQuery('user', assigned_to);

                    if (grpMember.hasNext()) {
                        while ( {

                return "sys_idIN" + groupsArray.join(',');

            type: "AssignmentGroupFilter",

You may also like...