-
Notifications
You must be signed in to change notification settings - Fork 925
Add Business Rule: Auto-Escalate Incident Priority for VIP Callers #2674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ayushmann13479
wants to merge
2
commits into
ServiceNowDevProgram:main
from
Ayushmann13479:add-vip-escalation-business-rule
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
...onents/Business Rules/Auto-Escalate Incident Priority for VIP Callers/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Auto-Escalate Incident Priority for VIP Callers | ||
|
|
||
| ## Description | ||
|
|
||
| A **Before Business Rule** on the `incident` table that automatically escalates the priority, urgency, and impact of an incident to **1 - Critical** whenever the caller is flagged as a VIP user in ServiceNow. | ||
|
|
||
| This prevents high-priority incidents from being logged at incorrect severity levels due to human error during intake. | ||
|
|
||
| ## Rule Configuration | ||
|
|
||
| | Field | Value | | ||
| |-------------|-------------------------------| | ||
| | Table | `incident` | | ||
| | When | `before` | | ||
| | Insert | ✅ Yes | | ||
| | Update | ✅ Yes | | ||
| | Condition | `current.caller_id.changes()` | | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - The `sys_user` table must have a **Boolean** field named `vip` (this is a default field in most ServiceNow instances). | ||
| - The Business Rule runs **before** insert/update so the escalated values are saved on first write — no additional update needed. | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. Navigate to **System Definition → Business Rules** in your ServiceNow instance. | ||
| 2. Click **New** and set the table to `incident`. | ||
| 3. Set **When** to `before`, and check both **Insert** and **Update**. | ||
| 4. Add the condition: `current.caller_id.changes()` | ||
| 5. Under the **Advanced** tab, paste the script from `auto_escalate_vip_incident.js`. | ||
| 6. Save and test by creating an incident with a VIP caller. | ||
|
|
||
| ## Example Output | ||
|
|
||
| When an incident is submitted for a VIP caller, the following fields are automatically set: | ||
|
|
||
| - **Priority:** 1 - Critical | ||
| - **Urgency:** 1 - High | ||
| - **Impact:** 1 - High | ||
| - **Work Notes:** `Priority automatically escalated to Critical. Caller John Doe is a VIP user.` | ||
|
|
||
| ## Notes | ||
|
|
||
| - To mark a user as VIP, go to their `sys_user` record and set the **VIP** field to `true`. | ||
| - This rule fires on every update where `caller_id` changes, so reassigning a ticket to a VIP caller mid-lifecycle also triggers the escalation. | ||
| - Pair this with a notification rule to alert the on-call team when a Critical incident is auto-created. |
21 changes: 21 additions & 0 deletions
...iness Rules/Auto-Escalate Incident Priority for VIP Callers/auto_escalate_vip_incident.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| (function executeRule(current, previous /*null when async*/) { | ||
|
|
||
| // Check if the caller is flagged as a VIP user | ||
| var caller = new GlideRecord('sys_user'); | ||
| if (caller.get(current.caller_id)) { | ||
| var isVIP = caller.getValue('vip'); // Boolean field on sys_user | ||
|
|
||
| if (isVIP === '1' || isVIP === 'true') { | ||
| // Escalate priority to '1 - Critical' and urgency to '1 - High' | ||
| current.setValue('priority', '1'); | ||
| current.setValue('urgency', '1'); | ||
| current.setValue('impact', '1'); | ||
|
|
||
| // Log the escalation in the work notes | ||
| current.work_notes = | ||
| 'Priority automatically escalated to Critical. ' + | ||
| 'Caller ' + caller.getDisplayValue('name') + ' is a VIP user.'; | ||
| } | ||
| } | ||
|
|
||
| })(current, previous); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.