How to use assignment rule scripting option
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2024 01:19 PM
Hi All,
How can I make use of the script option in Assignment rules? The requirement is to assign cases to 3 members from an assignment group.
for example, There are 3 categories the cases belong to: Category A, Category B, Category C and case will be automatically assigned to "Assignment group 1" when case is created from email. There are 8 members in "Assignment group 1". But only Member1,Member2 and Member3 needs to get the cases assigned. Also we need to make sure the 3 agents should receive an equal amount of cases from all category request types.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 06:06 AM
Hi @Marthageorge
In the Script section of the assignment rule, add the logic to assign the cases round-robin to the three specific members (Member1, Member2, and Member3).
var members = [
'sys_id_of_Member1', // Replace with the sys_id of Member1
'sys_id_of_Member2', // Replace with the sys_id of Member2
'sys_id_of_Member3' // Replace with the sys_id of Member3
];
// Check if the current assignment group is “Assignment group 1”
var assignmentGroup = 'sys_id_of_Assignment_group_1'; // Replace with the sys_id of the Assignment group 1
if (current.assignment_group == assignmentGroup) {
// Get the last assigned member from a custom table or system property
var lastAssigned = gs.getProperty('custom.last_assigned_member', 'sys_id_of_Member3');
var nextIndex = (members.indexOf(lastAssigned) + 1) % members.length;
// Assign the case to the next member in the list
var nextMember = members[nextIndex];
current.assigned_to = nextMember;
// Store the next assigned member in the system property
gs.setProperty('custom.last_assigned_member', nextMember);
}
- Go to System Properties > All Properties.
- Create a new property:
- Name: custom.last_assigned_member
- Type: String
- Value: sys_id_of_Member3 (Initial member, the last one in the array)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 08:54 AM
Hi @Marthageorge :
We have OOB Util called "Matching Rule" where you have multiple "selection criteria" that can be applied to the assignment of the records please explore that option where you can have dynamic scripts written rather than using assignment rule script conditions which will be a hassle to maintain
Mark this as Helpful / Accept the Solution if this clears your issue