Skip to content

Commit a5bf3df

Browse files
Auto assign incident based on keywords, ci, and department (#1946)
* script.js * Readme.md * Update script.js
1 parent 725950e commit a5bf3df

File tree

2 files changed

+57
-0
lines changed
  • Server-Side Components/Business Rules/Auto-Assign Incident Based on Keywords, CI, and Department

2 files changed

+57
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Auto-Assign Incident Based on Keywords, CI, and Department using Before Insert Business Rule
2+
3+
Automatically assigns incidents to the correct assignment group based on:
4+
5+
1.Keywords in the short description.
6+
7+
2.Configuration Item (CI) category.
8+
9+
3.Caller’s department.
10+
11+
Incidents should be routed automatically without manual intervention.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//Before Insert Business Rule
2+
3+
(function executeRule(current, previous) {
4+
5+
// Keyword-based assignment
6+
var shortDesc = current.short_description.toLowerCase();
7+
if (shortDesc.includes("server down")) {
8+
current.assignment_group = 'SERVER_SUPPORT_GROUP_SYS_ID';
9+
return;
10+
} else if (shortDesc.includes("email issue")) {
11+
current.assignment_group = 'EMAIL_SUPPORT_GROUP_SYS_ID';
12+
return;
13+
}
14+
15+
// CI-based assignment
16+
if (current.cmdb_ci) {
17+
var ciGR = new GlideRecord('cmdb_ci');
18+
if (ciGR.get(current.cmdb_ci)) {
19+
if (ciGR.category == 'Database') {
20+
current.assignment_group = 'DATABASE_SUPPORT_GROUP_SYS_ID';
21+
return;
22+
} else if (ciGR.category == 'Server') {
23+
current.assignment_group = 'SERVER_SUPPORT_GROUP_SYS_ID';
24+
return;
25+
}
26+
}
27+
}
28+
29+
// Department-based assignment
30+
if (current.caller_id) {
31+
var callerGR = new GlideRecord('sys_user');
32+
if (callerGR.get(current.caller_id)) {
33+
switch (callerGR.department.name) {
34+
case 'IT':
35+
current.assignment_group = 'IT_SUPPORT_GROUP_SYS_ID';
36+
break;
37+
case 'HR':
38+
current.assignment_group = 'HR_SUPPORT_GROUP_SYS_ID';
39+
break;
40+
default:
41+
current.assignment_group = 'GENERAL_SUPPORT_GROUP_SYS_ID';
42+
}
43+
}
44+
}
45+
46+
})(current, previous);

0 commit comments

Comments
 (0)