From 3abeb38353151c75baf8f6e9118d3b34659cb2c6 Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 19:57:08 +0530 Subject: [PATCH 1/3] Create readme.md 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. --- .../Business Rules/Incident Root Cause Suggestion/readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Server-Side Components/Business Rules/Incident Root Cause Suggestion/readme.md diff --git a/Server-Side Components/Business Rules/Incident Root Cause Suggestion/readme.md b/Server-Side Components/Business Rules/Incident Root Cause Suggestion/readme.md new file mode 100644 index 0000000000..1e414dbafe --- /dev/null +++ b/Server-Side Components/Business Rules/Incident Root Cause Suggestion/readme.md @@ -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. From ca3fe0ed50157bbf92483a2612f816f79d2559d7 Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 19:57:51 +0530 Subject: [PATCH 2/3] Create script include.js --- .../script include.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Server-Side Components/Business Rules/Incident Root Cause Suggestion/script include.js diff --git a/Server-Side Components/Business Rules/Incident Root Cause Suggestion/script include.js b/Server-Side Components/Business Rules/Incident Root Cause Suggestion/script include.js new file mode 100644 index 0000000000..21a1248e1c --- /dev/null +++ b/Server-Side Components/Business Rules/Incident Root Cause Suggestion/script include.js @@ -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' +}; From 29cf78e4833c61b07172165f5d59e31a5cac2dc2 Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 19:58:17 +0530 Subject: [PATCH 3/3] Create business rule.js --- .../business rule.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Server-Side Components/Business Rules/Incident Root Cause Suggestion/business rule.js diff --git a/Server-Side Components/Business Rules/Incident Root Cause Suggestion/business rule.js b/Server-Side Components/Business Rules/Incident Root Cause Suggestion/business rule.js new file mode 100644 index 0000000000..b8c745f3b9 --- /dev/null +++ b/Server-Side Components/Business Rules/Incident Root Cause Suggestion/business rule.js @@ -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);