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,15 @@
(function executeRule(current, previous /*null when async*/) {

// Only run if short_description or description changes
if (current.short_description.changes() || current.description.changes()) {

var helper = new IncidentRootCauseHelper();
var suggestions = helper.getRootCauseSuggestions(current.short_description + " " + current.description);

if (suggestions.length > 0) {
// Store suggestions in a custom field (multi-line text)
current.u_root_cause_suggestions = suggestions.join("\n");
}
}

})(current, previous);
Original file line number Diff line number Diff line change
@@ -0,0 +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
@@ -0,0 +1,30 @@
var IncidentRootCauseHelper = Class.create();
IncidentRootCauseHelper.prototype = {
initialize: function() {},

// Method to find potential root causes based on keywords
getRootCauseSuggestions: function(description) {
if (!description) return [];

var suggestions = [];
var gr = new GlideRecord('incident');
gr.addActiveQuery(); // Only active incidents
gr.addNotNullQuery('u_root_cause'); // Custom field storing root cause
gr.query();

while (gr.next()) {
var pastDesc = gr.short_description + " " + gr.description;
if (description.toLowerCase().indexOf(gr.short_description.toLowerCase()) != -1 ||
description.toLowerCase().indexOf(gr.description.toLowerCase()) != -1) {
suggestions.push(gr.u_root_cause.toString());
}
}

// Remove duplicates and limit to top 5 suggestions
suggestions = Array.from(new Set(suggestions)).slice(0, 5);

return suggestions;
},

type: 'IncidentRootCauseHelper'
};
Loading