File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
Server-Side Components/Business Rules/Incident Root Cause Suggestion Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ ( function executeRule ( current , previous /*null when async*/ ) {
2+
3+ // Only run if short_description or description changes
4+ if ( current . short_description . changes ( ) || current . description . changes ( ) ) {
5+
6+ var helper = new IncidentRootCauseHelper ( ) ;
7+ var suggestions = helper . getRootCauseSuggestions ( current . short_description + " " + current . description ) ;
8+
9+ if ( suggestions . length > 0 ) {
10+ // Store suggestions in a custom field (multi-line text)
11+ current . u_root_cause_suggestions = suggestions . join ( "\n" ) ;
12+ }
13+ }
14+
15+ } ) ( current , previous ) ;
Original file line number Diff line number Diff line change 1+ Automatically suggests potential root causes for incidents by analyzing past incidents with similar short descriptions or descriptions. This helps agents resolve incidents faster and reduces repetitive investigation effort.
Original file line number Diff line number Diff line change 1+ var IncidentRootCauseHelper = Class . create ( ) ;
2+ IncidentRootCauseHelper . prototype = {
3+ initialize : function ( ) { } ,
4+
5+ // Method to find potential root causes based on keywords
6+ getRootCauseSuggestions : function ( description ) {
7+ if ( ! description ) return [ ] ;
8+
9+ var suggestions = [ ] ;
10+ var gr = new GlideRecord ( 'incident' ) ;
11+ gr . addActiveQuery ( ) ; // Only active incidents
12+ gr . addNotNullQuery ( 'u_root_cause' ) ; // Custom field storing root cause
13+ gr . query ( ) ;
14+
15+ while ( gr . next ( ) ) {
16+ var pastDesc = gr . short_description + " " + gr . description ;
17+ if ( description . toLowerCase ( ) . indexOf ( gr . short_description . toLowerCase ( ) ) != - 1 ||
18+ description . toLowerCase ( ) . indexOf ( gr . description . toLowerCase ( ) ) != - 1 ) {
19+ suggestions . push ( gr . u_root_cause . toString ( ) ) ;
20+ }
21+ }
22+
23+ // Remove duplicates and limit to top 5 suggestions
24+ suggestions = Array . from ( new Set ( suggestions ) ) . slice ( 0 , 5 ) ;
25+
26+ return suggestions ;
27+ } ,
28+
29+ type : 'IncidentRootCauseHelper'
30+ } ;
You can’t perform that action at this time.
0 commit comments