Create an advanced reference qualifier

For more advanced filtering, create an Advanced Reference Qualifier for the Assignment Group field on the Task table.

For more advanced filtering, create an advanced reference qualifier for the Assignment Group field on the Task [task] table. Note that this reference qualifier will apply to all tables based on [task], unless dictionary overrides are used.

The following example reference qualifier assumes that you have created a group type named database. If the task is an incident record and the category is Database, then the reference qualifier will only select database groups. In all other circumstances it will select any group which is not a catalog group.

Figure 1. Advanced Reference Qualifier Business Rule
function TaskAssignmentFilter() {
  var classname = current.getRecordClassName();
  var filter = "type=null";
  if (classname == "incident" && current.category == "database") {
    filter = GetGroupFilter("database");
  }
  else {
    // append exclusion for 'catalog' to the filter
    var cat = new GlideRecord("sys_user_group_type");  
    cat.addQuery("name", "catalog");
    cat.query();
    if (cat.next()) {
      filter += "^ORtype!=" + cat.sys_id;
    }
  }
  gs.log("TaskAssignmentFilter: " + filter);
  return filter;
}

Once the business rule above is defined, it can be called by the following reference qualifier:

javascript:TaskAssignmentFilter()