Blog

Preventing Individual Assignment if not part of that Group

How can you restrict people from using the "Assigned To" field on incidents from assigning incidents directly to people if they are not a member of that group?

The issue is that when people do this, they may directly assign an incident to someone who is out-of-the-office, busy on another project, or already working too many incidents.

This customization seems like a good idea at first.  I put this business rule in at a few companies with no complaints.  Later on when I took a permanent job, I realized this business rule can have some Pros and Cons to it.  You can evaluate this Business Rule for yourself and determine if it works for your company.

Pros and Cons of adding this rule

Pros

  • People can't assign incidents directly to individuals if they are not in that group.
  • Lowers the frequency of assigning incidents to favorites, people OOO, or not available due to workload
  • Allows groups to assign incidents who better know can handle the incident

Cons

  • When you are working with another person in another group, you can't reassign the incident back and forth.
  • Also if you are working directly with someone else, you can't assign an incident directly to them if you are not in a group.

Business Rule

Name: Assignment Group Check
When: before
Insert/Update: true
Table: Incident [incident]
Condition: current.assigned_to.changes() && !current.assignment_group.nil() && !gs.hasRole('admin') && !current.assigned_to.nil()
Script:
assignedToGroupCheck();
function assignedToGroupCheck() {
if (!gs.getUser().isMemberOf(current.assignment_group)) {
current.assignment_group = previous.assignment_group;
current.assigned_to = previous.assigned_to;
//current.setAbortAction(true);
gs.addErrorMessage('Can not set assigned to unless you are a member of that Assignment group ');
}
}

Also note in ServiceNow Geneva (not released yet) you can assign an incident to multiple people at once.  This script may need to change in Geneva.

Mike