File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Server-Side Components/Business Rules/EnhanceIncidentWithProblem Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 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 ) ;
You can’t perform that action at this time.
0 commit comments