Skip to content

Commit b96ff94

Browse files
authored
Create Readme.md
The script programmatically creates a new incident record with high urgency and impact, ensuring it is classified as Priority 1. It sets essential fields such as short description, category, and caller information.
1 parent 951528f commit b96ff94

File tree

1 file changed

+43
-0
lines changed
  • Server-Side Components/Background Scripts/Incident

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Create Priority 1 Incident in ServiceNow
2+
3+
This script is designed to create a **Priority 1 incident** in ServiceNow using the GlideRecord API. It can be used in a Script Include, Business Rule, or Background Script to automate the creation of critical incidents.
4+
5+
## 📝 Script Purpose
6+
7+
The script programmatically creates a new incident record with high urgency and impact, ensuring it is classified as Priority 1. It sets essential fields such as short description, category, and caller information.
8+
9+
## ✅ Key Features
10+
11+
- Initializes a new incident record.
12+
- Sets the following fields:
13+
- `short_description`: Brief summary of the incident.
14+
- `description`: Detailed explanation of the issue.
15+
- `priority`: Set to `1` (Critical).
16+
- `impact`: Set to `1` (High).
17+
- `urgency`: Set to `1` (High).
18+
- `caller_id`: Automatically assigned to the current user.
19+
- `category`: Example category set to `'network'`.
20+
- Inserts the incident record into the database.
21+
- Logs the newly created incident's sys_id.
22+
23+
## 🚀 Usage
24+
25+
This script can be placed in:
26+
- A **Script Include** to be called programmatically.
27+
- A **Business Rule** to trigger incident creation based on conditions.
28+
- A **Background Script** for manual execution.
29+
30+
## 📌 Example
31+
32+
33+
var incidentGR = new GlideRecord('incident');
34+
incidentGR.initialize();
35+
incidentGR.short_description = 'Critical Incident - Immediate Attention Required';
36+
incidentGR.description = 'This is a Priority 1 incident created via script.';
37+
incidentGR.priority = 1;
38+
incidentGR.impact = 1;
39+
incidentGR.urgency = 1;
40+
incidentGR.caller_id = gs.getUserID();
41+
incidentGR.category = 'network';
42+
var newIncidentID = incidentGR.insert();
43+
gs.info('New Incident created with ID: ' + newIncidentID);

0 commit comments

Comments
 (0)