Incident should auto-assign based on the assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 10:03 PM
Hi All,
I have a requirement based on user country incident should auto-assign. suppose for india if i have 4 groups based on weight and order ticket need to routing.
through script 1) it should be assign to 8900 group and then 123 group. after that software and hardware both weight are same at that time it need to assign based on order.
2) based on weight tickets should assign. if weight is 5 only 5 tickets should assign for s/h remaining should be assign other groups. same as 8900 it should assign 50 tickets
how can i achieve this using business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 10:25 PM
Hi @Lakshmi53 , Try this script in business rule -
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var count;
var inc = new GlideAggregate('incident');
inc.addAggregate('COUNT');
inc.groupBy('assignment_group');
inc.addQuery('assignment_group', 'IN', '553032e853165110b846ddeeff7b12aa,019ad92ec7230010393d265c95c260dd,8a4dde73c6112278017a6a4baf547aa7,8a5055c9c61122780043563ef53438e3');
inc.query();
while (inc.next()) {
var getName = inc.getDisplayValue('assignment_group');
if (getName == '8900') {
count = inc.getAggregate('COUNT');
if (count < 50)
current.setValue('assignment_group', '553032e853165110b846ddeeff7b12aa');
} else if (getName == '123') {
count = inc.getAggregate('COUNT');
if (count < 40)
current.setValue('assignment_group', '019ad92ec7230010393d265c95c260dd');
} else if (getName == 'Software') {
count = inc.getAggregate('COUNT');
if (count < 5)
current.setValue('assignment_group', '8a4dde73c6112278017a6a4baf547aa7');
} else if (getName == 'Hardware') {
count = inc.getAggregate('COUNT');
if (count < 5)
current.setValue('assignment_group', '8a5055c9c61122780043563ef53438e3');
}
current.update();
current.setWorkflow(false);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 11:00 PM
where are you storing this data? in some custom table?
are you saying the country for the caller?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 08:55 AM
it's custom table and written below script but not working