Auto Assign HR case based on Alphabetical List

Cathy Ball
Tera Contributor

I have a requirement to auto assign a case to a particular HR agent based on an alphabetical list. For example: 

 

1. Agent 1 handles cases with a subject person with last name of A-M.

2. Agent 2 handles cases with a subject person with last name of N-Z.

 

How would I go about setting this up? Assignment rules? Advanced Work Assignment? I am just not sure of the best way to do this nor how to do it. Thanks!

2 REPLIES 2

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

Hi @Cathy Ball I would caution this process due to the query it will require adding overhead to performance and other factors. Not that this query to look at the name will bring the system to its knees, but you are now using additional logic that concerns me. In addition to this, AWA offers some very nice features to accommodate for Capacity, Skills and the like so setting up something like this will totally impact any adoption of the features we use to make assignments very precise (like the PI suggestions and Agent Affinity). Again, just trying to give some guidance to keep you on a good path to consume the many features we offer to deliver a great experience. 

 

Regards,

Mike

Sandeep Rajput
Tera Patron
Tera Patron

@Cathy Ball Business rule can be one of the ways to achieve this.

I have created one sample for you which you can try on one of your dev/sandbox instance to test.

 

Screenshot 2024-05-29 at 9.50.40 PM.pngScreenshot 2024-05-29 at 9.51.33 PM.png

Here is the script.

 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var userLastNameChar = current.subject_person.last_name.toUpperCase().charAt(0);//get subject person's first letter of last name

	var firstAssigneeRange = ['A','B','C','D','E','F','G','H','I','J','K','L','M'];

	var secondAssigneeRange = ['N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

	if(firstAssigneeRange.indexOf(userLastNameChar)>-1){		
		current.setValue('assigned_to','7a8929983b9c445052ca655593efc440');	//Replace with sys_id of Agent 1	
	}
	else if(secondAssigneeRange.indexOf(userLastNameChar)>-1){		
		current.setValue('assigned_to','3a8965143b1c445052ca655593efc4e6');		//Replace with sys_id of Agent 2	
	}


})(current, previous);

Hope this helps.