Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function executeRule(current, previous /*null when async*/) {
try {
// Check if problem_id was added or changed
var isNewLink = !previous || current.problem_id.changes();

if (isNewLink && current.problem_id) {
var problemGR = new GlideRecord("problem");

if (problemGR.get(current.problem_id)) {
var problemStatement = problemGR.short_description;
var problemNumber = problemGR.number;

// Append to description
current.description = (current.description || '') +
"\n\n[Linked Problem] " + problemNumber + ": " + problemStatement;
}
}
} catch (ex) {
gs.error("An unexpected error occurred while enhancing the Incident with Problem details.");
}
})(current, previous);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Enhance Incident Description with Linked Problem Statement

## Overview
This ServiceNow Business Rule enhances Incident records by automatically appending the short description of a linked Problem record. It improves visibility and context for support teams working on related incidents.

## Features
- Triggered when a Problem ID is newly linked or changed on an Incident.
- Fetches the Problem's short description and number.
- Appends the Problem Statement to both the Incident's short description and description fields.
- Includes general error handling to ensure stability.

## Business Rule Configuration
- Table: `incident`
- When to Run: `before insert` and `before update`
- Condition:
```javascript
current.problem_id.changes() || !previous
Loading