Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Constrain the assignment group field

Log in to subscribe to topics and get notified when content changes.

Constrain the assignment group field

This example shows how to use an advanced reference qualifier with JavaScript and a script include to restrict the incident Assignment group choices to only the groups that contain the user specified in the Assigned to field.

Before you begin

Role required: personalize_dictionary or admin


  1. Open an incident.
  2. Right-click the Assignment group label and select Configure Dictionary.
  3. If the form appears in Default view, under Related Links, click Advanced view.
  4. In the Use reference qualifier field, ensure that the Advanced option is selected.
  5. In the Reference qual field, enter javascript:new ReferenceQualifierHelper().backfillAssignmentGroup().
  6. Save the record.
  7. Navigate to System Definitions > Script Includes.
  8. Click New.
  9. Create a script include with the following JavaScript code. Ensure that the Accessible form field is properly set for the environment.
    var ReferenceQualifierHelper = Class.create();
    ReferenceQualifierHelper.prototype = {
    	backfillAssignmentGroup:function() {
    		var assigneeGroupsQualifier = '';
    		var assignee = current.assigned_to;
    		//return if the assigned_to value is empty (this causes all groups to be returned)
    		//sys_user_grmember has the user to group relationship
    		var grAssigneeGroups = new GlideRecord('sys_user_grmember');
    		while( {
    			if (assigneeGroupsQualifier.length == 0) {
    				// Create the beginning of the qualifier and add the 1st group
    				assigneeGroupsQualifier = 'sys_idIN' + grAssigneeGroups.getValue('group');
    			else {
    				// build a comma separated string of groups if there is more than one
    				assigneeGroupsQualifier += (',' +;
    		// return Groups where assigned to is in those groups we use IN for lists
    		gs.log('DP: RefQual = ' + assigneeGroupsQualifier);
    		return assigneeGroupsQualifier;
    	type: 'ReferenceQualifierHelper'

What to do next

To test, create an incident and select a user in the Assigned to field. Click the Assignment group lookup icon. Only the groups that contain the user you selected appear. For example, you assign an incident to Bob Smith, who belongs to the Database group and the Networking group. The only options that appear in the assignment group are Database and Networking.