Skip to content

Commit 07aac64

Browse files
My second contribution (#2137)
* Create Emotion-Aware.js * Update Emotion-Aware.js 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”) * 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. * 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. * Delete Server-Side Components/Script Includes/Emotion-Aware.js * 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.
1 parent 68bba99 commit 07aac64

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//Scenario: whenever a user submits a ticket (Incident, HR Case, etc.), the system analyzes the tone of the message - like frustrated, urgent, calm, confused
2+
// and automatically adjusts the ticket priority, or routes it to a specific team (like “Empathy Response Desk)
3+
4+
var EmotionAnalyzer = Class.create();
5+
EmotionAnalyzer.prototype = {
6+
initialize: function() {},
7+
8+
detectEmotion: function(text) {
9+
try {
10+
// ---- Mock Sentiment Logic (No external API) ----
11+
text = text.toLowerCase();
12+
var score = 0;
13+
var negativeWords = ['angry', 'frustrated', 'bad', 'urgent', 'hate', 'delay'];
14+
var positiveWords = ['thank', 'happy', 'great', 'awesome', 'love'];
15+
16+
negativeWords.forEach(function(word) {
17+
if (text.includes(word)) score -= 1;
18+
});
19+
positiveWords.forEach(function(word) {
20+
if (text.includes(word)) score += 1;
21+
});
22+
23+
var sentiment = (score > 0) ? 'positive' : (score < 0) ? 'negative' : 'neutral';
24+
return { sentiment: sentiment, score: Math.abs(score / 3) };
25+
} catch (e) {
26+
gs.error("EmotionAnalyzer error: " + e.message);
27+
return { sentiment: 'neutral', score: 0 };
28+
}
29+
},
30+
31+
type: 'EmotionAnalyzer'
32+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### Overview
2+
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.
3+
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.
4+
5+
---
6+
7+
## How It Works
8+
1. When a ticket is created, a **Business Rule** triggers a **Script Include** (`EmotionAnalyzer`).
9+
2. The Script Include analyzes the short description and description text.
10+
3. It detects emotional tone — *positive*, *neutral*, or *negative*.
11+
4. Based on sentiment, the system:
12+
- Adjusts **priority** automatically
13+
- Adds a **work note** with detected emotion
14+
- Optionally, notifies the support team for urgent or frustrated cases
15+
16+
---
17+
## How It Trigger Script Include Via Business Rule
18+
1. Create object of Script Include (Accessible from all scopes)
19+
var util = new global.EmotionAnalyzer();
20+
21+
----
22+
## Example line as input and output
23+
| User Input | Detected Emotion | Auto Priority | Output |
24+
| -------------------------------------- | ---------------- | ------------- | --------------------- |
25+
| “Laptop crashed again, no one helps!” | Negative | 1 (Critical) | Escalate to VIP queue |
26+
| “Thank you, system working great now!” | Positive | 4 (Low) | No action |
27+
| “Need help resetting my password.” | Neutral | 3 (Moderate) | Normal SLA |
28+
29+

0 commit comments

Comments
 (0)