Skip to content

Commit b5c7278

Browse files
authored
Bulk change of incident priority based on category (#1151)
* Add files via upload * Create code.js This script contains two parts, 1st part is client script and 2nd part is script include.. and this helps to lock the file till the developer completes his development, so that we can avoid concurrency issues. Ex: If a "Developer A" working on "Widget A", parallelly if "Developer B" working on "Widget B", then if Developer B moves the code to higher environment before developer A completes his development.. so it creates an issue.. to avoid these kind of concurrency issues.. we can use locking system for each record.. in the above script I shown example for widget records. * Delete code.js * Delete DisplayTableandFieldNames.js * Delete readme.md.txt * Create code.js Calculate the time difference between incident creation and change implementation * code.js Set due date to incidents based on their priority and the assignment group's working hours * Delete Business Rules/Set due date to incidents based on their priority and the assignment group's working hours directory * Delete Background Scripts/Calculate time difference between incident creation and related change implementation directory * Bulk Change of Incident Priority Based on Category.js * readme.md
1 parent f9957be commit b5c7278

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var priorityMapping = {
2+
'Network': 1,
3+
'Application': 2,
4+
'Hardware': 3
5+
};
6+
7+
var incidentGR = new GlideRecord('incident');
8+
incidentGR.addQuery('active', true);
9+
incidentGR.query();
10+
11+
while (incidentGR.next()) {
12+
var category = incidentGR.category.toString();
13+
var newPriority = priorityMapping[category];
14+
15+
if (newPriority) {
16+
incidentGR.priority = newPriority;
17+
incidentGR.update();
18+
gs.info('Updated Incident: ' + incidentGR.number + ' to Priority: ' + newPriority);
19+
}
20+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The code helps to automates the bulk update of incident priorities based on predefined category mappings.

0 commit comments

Comments
 (0)