Skip to content

Commit 2aa679b

Browse files
Background Script : To fetch the incidents having VIP caller (#1692)
* VIP-caller-incidents.js * readme.md * Update VIP-caller-incidents.js * VIP-caller-incidents.js
1 parent 1ab8b64 commit 2aa679b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Name: VIP Caller Incidents
3+
* Type: Background Script
4+
* Purpose: Prints all incidents where the caller is a VIP user
5+
* Author: Shashank Jain
6+
*/
7+
8+
var inc = new GlideRecord('incident');
9+
inc.addQuery('caller_id.vip', true); // Only VIP callers
10+
inc.query();
11+
gs.print("Incidents with VIP Callers:");
12+
while (inc.next()) {
13+
gs.print("Number: " + inc.number + " | Short Description: " + inc.short_description);
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# VIP Caller Incidents Background Script
2+
3+
## Description
4+
This background script fetches all incidents where the caller is marked as a VIP user
5+
and prints the incident number and short description in the logs.
6+
7+
## Usage
8+
1. Go to **System Definition > Scripts - Background** in ServiceNow.
9+
2. Paste the script into the editor.
10+
3. Click **Run Script**.
11+
4. Check the output in the logs.
12+
13+
## Prerequisites
14+
- The User table must have a **VIP checkbox** (`vip` field).
15+
- The Incident table must have a `caller_id` reference field.
16+

0 commit comments

Comments
 (0)