From 322d8e96c7892076eb40a9b4ea305a3f4bd634b9 Mon Sep 17 00:00:00 2001 From: Ravi Gaurav Date: Tue, 14 Oct 2025 15:13:34 +0530 Subject: [PATCH 1/6] Create Emotion-Aware.js --- Server-Side Components/Script Includes/Emotion-Aware.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 Server-Side Components/Script Includes/Emotion-Aware.js diff --git a/Server-Side Components/Script Includes/Emotion-Aware.js b/Server-Side Components/Script Includes/Emotion-Aware.js new file mode 100644 index 0000000000..816a82e97c --- /dev/null +++ b/Server-Side Components/Script Includes/Emotion-Aware.js @@ -0,0 +1 @@ +//Imagine: whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message — like frustrated, urgent, calm, confused — and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk From d6ddf0aafa99c76540bd510ad672380e4d8037a1 Mon Sep 17 00:00:00 2001 From: Ravi Gaurav Date: Tue, 14 Oct 2025 15:24:51 +0530 Subject: [PATCH 2/6] Update Emotion-Aware.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message -like frustrated, urgent, calm, confused - and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk”) --- .../Script Includes/Emotion-Aware.js | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Server-Side Components/Script Includes/Emotion-Aware.js b/Server-Side Components/Script Includes/Emotion-Aware.js index 816a82e97c..198dfc6c6e 100644 --- a/Server-Side Components/Script Includes/Emotion-Aware.js +++ b/Server-Side Components/Script Includes/Emotion-Aware.js @@ -1 +1,32 @@ -//Imagine: whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message — like frustrated, urgent, calm, confused — and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk +//Scenario: whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message - like frustrated, urgent, calm, confused +// and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk) + +var EmotionAnalyzer = Class.create(); +EmotionAnalyzer.prototype = { + initialize: function() {}, + + detectEmotion: function(text) { + try { + // ---- Mock Sentiment Logic (No external API) ---- + text = text.toLowerCase(); + var score = 0; + var negativeWords = ['angry', 'frustrated', 'bad', 'urgent', 'hate', 'delay']; + var positiveWords = ['thank', 'happy', 'great', 'awesome', 'love']; + + negativeWords.forEach(function(word) { + if (text.includes(word)) score -= 1; + }); + positiveWords.forEach(function(word) { + if (text.includes(word)) score += 1; + }); + + var sentiment = (score > 0) ? 'positive' : (score < 0) ? 'negative' : 'neutral'; + return { sentiment: sentiment, score: Math.abs(score / 3) }; + } catch (e) { + gs.error("EmotionAnalyzer error: " + e.message); + return { sentiment: 'neutral', score: 0 }; + } + }, + + type: 'EmotionAnalyzer' +}; From 880ece8be19e885c486abe7c4fb2495648cdb678 Mon Sep 17 00:00:00 2001 From: Ravi Gaurav Date: Tue, 14 Oct 2025 15:37:14 +0530 Subject: [PATCH 3/6] Create EmotionAnalyzer.js An AI-powered ServiceNow innovation that automatically analyzes the tone and emotion of user-submitted tickets (like incidents or HR cases) to detect frustration, urgency, or satisfaction. --- .../Emotion-Aware/EmotionAnalyzer.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Server-Side Components/Script Includes/Emotion-Aware/EmotionAnalyzer.js diff --git a/Server-Side Components/Script Includes/Emotion-Aware/EmotionAnalyzer.js b/Server-Side Components/Script Includes/Emotion-Aware/EmotionAnalyzer.js new file mode 100644 index 0000000000..198dfc6c6e --- /dev/null +++ b/Server-Side Components/Script Includes/Emotion-Aware/EmotionAnalyzer.js @@ -0,0 +1,32 @@ +//Scenario: whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message - like frustrated, urgent, calm, confused +// and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk) + +var EmotionAnalyzer = Class.create(); +EmotionAnalyzer.prototype = { + initialize: function() {}, + + detectEmotion: function(text) { + try { + // ---- Mock Sentiment Logic (No external API) ---- + text = text.toLowerCase(); + var score = 0; + var negativeWords = ['angry', 'frustrated', 'bad', 'urgent', 'hate', 'delay']; + var positiveWords = ['thank', 'happy', 'great', 'awesome', 'love']; + + negativeWords.forEach(function(word) { + if (text.includes(word)) score -= 1; + }); + positiveWords.forEach(function(word) { + if (text.includes(word)) score += 1; + }); + + var sentiment = (score > 0) ? 'positive' : (score < 0) ? 'negative' : 'neutral'; + return { sentiment: sentiment, score: Math.abs(score / 3) }; + } catch (e) { + gs.error("EmotionAnalyzer error: " + e.message); + return { sentiment: 'neutral', score: 0 }; + } + }, + + type: 'EmotionAnalyzer' +}; From e7db5e5fb36027fe089b49533cce9e39bde20be8 Mon Sep 17 00:00:00 2001 From: Ravi Gaurav Date: Tue, 14 Oct 2025 15:40:10 +0530 Subject: [PATCH 4/6] Create README.md This Readme introduces an Emotion-Aware Ticket Prioritizer for ServiceNow -an AI-inspired solution that detects user emotions (like frustration or satisfaction) from ticket text and automatically adjusts priority, routing, and responses. It combines sentiment analysis with workflow automation to make ServiceNow more empathetic, intelligent, and user-focused. --- .../Script Includes/Emotion-Aware/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Server-Side Components/Script Includes/Emotion-Aware/README.md diff --git a/Server-Side Components/Script Includes/Emotion-Aware/README.md b/Server-Side Components/Script Includes/Emotion-Aware/README.md new file mode 100644 index 0000000000..bdf11bd287 --- /dev/null +++ b/Server-Side Components/Script Includes/Emotion-Aware/README.md @@ -0,0 +1,16 @@ +### Overview +The **Emotion-Aware Ticket Prioritizer** is an AI-driven innovation for ServiceNow that automatically analyzes the tone and emotion of user-submitted tickets (Incidents, HR Cases, etc.) to determine the urgency and emotional state of the user. +If frustration or urgency is detected, the system dynamically increases the **priority**, adds contextual **work notes**, and routes the ticket to the right team — ensuring faster resolution and better user experience. + +--- + +## How It Works +1. When a ticket is created, a **Business Rule** triggers a **Script Include** (`EmotionAnalyzer`). +2. The Script Include analyzes the short description and description text. +3. It detects emotional tone — *positive*, *neutral*, or *negative*. +4. Based on sentiment, the system: + - Adjusts **priority** automatically + - Adds a **work note** with detected emotion + - Optionally, notifies the support team for urgent or frustrated cases + +--- From 19336c301ec8bf8ccd115524363ac9e4eaa6dfaf Mon Sep 17 00:00:00 2001 From: Ravi Gaurav Date: Tue, 14 Oct 2025 15:43:36 +0530 Subject: [PATCH 5/6] Delete Server-Side Components/Script Includes/Emotion-Aware.js --- .../Script Includes/Emotion-Aware.js | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 Server-Side Components/Script Includes/Emotion-Aware.js diff --git a/Server-Side Components/Script Includes/Emotion-Aware.js b/Server-Side Components/Script Includes/Emotion-Aware.js deleted file mode 100644 index 198dfc6c6e..0000000000 --- a/Server-Side Components/Script Includes/Emotion-Aware.js +++ /dev/null @@ -1,32 +0,0 @@ -//Scenario: whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message - like frustrated, urgent, calm, confused -// and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk) - -var EmotionAnalyzer = Class.create(); -EmotionAnalyzer.prototype = { - initialize: function() {}, - - detectEmotion: function(text) { - try { - // ---- Mock Sentiment Logic (No external API) ---- - text = text.toLowerCase(); - var score = 0; - var negativeWords = ['angry', 'frustrated', 'bad', 'urgent', 'hate', 'delay']; - var positiveWords = ['thank', 'happy', 'great', 'awesome', 'love']; - - negativeWords.forEach(function(word) { - if (text.includes(word)) score -= 1; - }); - positiveWords.forEach(function(word) { - if (text.includes(word)) score += 1; - }); - - var sentiment = (score > 0) ? 'positive' : (score < 0) ? 'negative' : 'neutral'; - return { sentiment: sentiment, score: Math.abs(score / 3) }; - } catch (e) { - gs.error("EmotionAnalyzer error: " + e.message); - return { sentiment: 'neutral', score: 0 }; - } - }, - - type: 'EmotionAnalyzer' -}; From 5b3cf0237a1e8467e15a0193214cde31c97521fc Mon Sep 17 00:00:00 2001 From: Ravi Gaurav Date: Tue, 14 Oct 2025 15:58:37 +0530 Subject: [PATCH 6/6] Update README.md The **Emotion-Aware Ticket Prioritizer** is an AI-powered ServiceNow solution that automatically analyzes the **tone and emotion** of user-submitted tickets (like Incidents or HR Cases). It dynamically adjusts **priority**, adds **contextual work notes**, and notifies the right team based on detected emotion -improving SLA compliance and customer satisfaction. --- .../Script Includes/Emotion-Aware/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Server-Side Components/Script Includes/Emotion-Aware/README.md b/Server-Side Components/Script Includes/Emotion-Aware/README.md index bdf11bd287..ea5d281780 100644 --- a/Server-Side Components/Script Includes/Emotion-Aware/README.md +++ b/Server-Side Components/Script Includes/Emotion-Aware/README.md @@ -14,3 +14,16 @@ If frustration or urgency is detected, the system dynamically increases the **pr - Optionally, notifies the support team for urgent or frustrated cases --- +## How It Trigger Script Include Via Business Rule +1. Create object of Script Include (Accessible from all scopes) + var util = new global.EmotionAnalyzer(); + +---- +## Example line as input and output +| User Input | Detected Emotion | Auto Priority | Output | +| -------------------------------------- | ---------------- | ------------- | --------------------- | +| “Laptop crashed again, no one helps!” | Negative | 1 (Critical) | Escalate to VIP queue | +| “Thank you, system working great now!” | Positive | 4 (Low) | No action | +| “Need help resetting my password.” | Neutral | 3 (Moderate) | Normal SLA | + +