Skip to content

Commit e4dcd11

Browse files
authored
Add Business Rule: Enhance Incident Description with Linked Problem Statement
1 parent f8120aa commit e4dcd11

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
function executeRule(current, previous /*null when async*/) {
2+
try {
3+
// Check if problem_id was added or changed
4+
var isNewLink = !previous || current.problem_id.changes();
5+
6+
if (isNewLink && current.problem_id) {
7+
var problemGR = new GlideRecord("problem");
8+
9+
if (problemGR.get(current.problem_id)) {
10+
var problemStatement = problemGR.short_description;
11+
var problemNumber = problemGR.number;
12+
13+
// Append to description
14+
current.description = (current.description || '') +
15+
"\n\n[Linked Problem] " + problemNumber + ": " + problemStatement;
16+
}
17+
}
18+
} catch (ex) {
19+
gs.error("An unexpected error occurred while enhancing the Incident with Problem details.");
20+
}
21+
})(current, previous);

0 commit comments

Comments
 (0)