From 18fa403081d5eef22b882070b8406f4d995e10ec Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 20:08:09 +0530 Subject: [PATCH 1/4] Create readme.md This tool dynamically identifies dependencies across multiple ServiceNow tables such as Incidents, Problems, Changes, and CMDB CIs, and alerts users or teams if a record update might impact other related records. Unlike OOB impact analysis, this is dynamic, real-time, and customizable for any relationships your organization cares about. --- .../Business Rules/Cross-Table Dependency Analyzer/readme.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md diff --git a/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md new file mode 100644 index 0000000000..00397c101a --- /dev/null +++ b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md @@ -0,0 +1,3 @@ +This tool dynamically identifies dependencies across multiple ServiceNow tables such as Incidents, Problems, Changes, and CMDB CIs, and alerts users or teams if a record update might impact other related records. + +Unlike OOB impact analysis, this is dynamic, real-time, and customizable for any relationships your organization cares about. From 796252c118755f5ef702a763235cec2c0e9cc508 Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 20:08:32 +0530 Subject: [PATCH 2/4] Create scriptInclude.js --- .../scriptInclude.js | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/scriptInclude.js diff --git a/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/scriptInclude.js b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/scriptInclude.js new file mode 100644 index 0000000000..825ded824e --- /dev/null +++ b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/scriptInclude.js @@ -0,0 +1,57 @@ +var CrossTableDependencyAnalyzer = Class.create(); +CrossTableDependencyAnalyzer.prototype = { + initialize: function() {}, + + // Get related records for a CI or task + getDependencies: function(record) { + var dependencies = []; + + if (!record) return dependencies; + + var ciId = record.cmdb_ci; // for incidents or changes + if (ciId) { + // Find active incidents for this CI + var inc = new GlideRecord('incident'); + inc.addQuery('cmdb_ci', ciId); + inc.addActiveQuery(); + inc.query(); + while (inc.next()) { + dependencies.push({ + table: 'incident', + number: inc.number.toString(), + state: inc.state.toString() + }); + } + + // Find active changes for this CI + var chg = new GlideRecord('change_request'); + chg.addQuery('cmdb_ci', ciId); + chg.addActiveQuery(); + chg.query(); + while (chg.next()) { + dependencies.push({ + table: 'change_request', + number: chg.number.toString(), + state: chg.state.toString() + }); + } + + // Find problems linked to this CI + var prb = new GlideRecord('problem'); + prb.addQuery('cmdb_ci', ciId); + prb.addActiveQuery(); + prb.query(); + while (prb.next()) { + dependencies.push({ + table: 'problem', + number: prb.number.toString(), + state: prb.state.toString() + }); + } + } + + return dependencies; + }, + + type: 'CrossTableDependencyAnalyzer' +}; From da1ab4b64dd6b9f5716cd71aae77b4c81b26df5f Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 20:08:55 +0530 Subject: [PATCH 3/4] Create businessrule.js --- .../Cross-Table Dependency Analyzer/businessrule.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/businessrule.js diff --git a/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/businessrule.js b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/businessrule.js new file mode 100644 index 0000000000..dfe171fa30 --- /dev/null +++ b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/businessrule.js @@ -0,0 +1,11 @@ +(function executeRule(current, previous /*null when async*/) { + + var analyzer = new CrossTableDependencyAnalyzer(); + var deps = analyzer.getDependencies(current); + + if (deps.length > 0) { + var messages = deps.map(function(d){ return d.table + ': ' + d.number + ' (' + d.state + ')'; }); + current.comments = 'Potential impact on related records:\n' + messages.join('\n'); + } + +})(current, previous); From 973a86fcfc4226edae46185dd83467bc396e5417 Mon Sep 17 00:00:00 2001 From: vijaykumar7177 <68215714+vijaykumar7177@users.noreply.github.com> Date: Sat, 18 Oct 2025 20:09:39 +0530 Subject: [PATCH 4/4] Update readme.md --- .../Business Rules/Cross-Table Dependency Analyzer/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md index 00397c101a..2db0f55614 100644 --- a/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md +++ b/Server-Side Components/Business Rules/Cross-Table Dependency Analyzer/readme.md @@ -1,3 +1,3 @@ -This tool dynamically identifies dependencies across multiple ServiceNow tables such as Incidents, Problems, Changes, and CMDB CIs, and alerts users or teams if a record update might impact other related records. +The Cross-Table Dependency Analyzer is a custom ServiceNow solution designed to dynamically detect and analyze dependencies across multiple tables such as Incidents, Problems, Changes, and Configuration Items (CIs). This tool ensures that updates to one record do not inadvertently impact related records across the system, providing better visibility, risk mitigation, and proactive management. -Unlike OOB impact analysis, this is dynamic, real-time, and customizable for any relationships your organization cares about. +Unlike out-of-the-box (OOB) impact analysis, this solution is fully customizable, real-time, and developer-driven, making it suitable for organizations with complex IT processes or interdependent services.