From fd3dbf95f7998083f376d1d17dd4e33da28a4c8b Mon Sep 17 00:00:00 2001 From: Thrizvi <145013431+Thrizvi@users.noreply.github.com> Date: Mon, 13 Oct 2025 12:25:23 +0530 Subject: [PATCH 1/2] Create P1 Incident This script automates the creation of a **Priority 1 (P1)** Incident in ServiceNow. It is useful for testing, automation, or simulating critical incident scenarios. --- .../Create P1 Incident/P1 Incident | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Create P1 Incident/P1 Incident diff --git a/Server-Side Components/Background Scripts/Create P1 Incident/P1 Incident b/Server-Side Components/Background Scripts/Create P1 Incident/P1 Incident new file mode 100644 index 0000000000..9bfdd7ae80 --- /dev/null +++ b/Server-Side Components/Background Scripts/Create P1 Incident/P1 Incident @@ -0,0 +1,15 @@ +(function() { + var incidentGR = new GlideRecord('incident'); + incidentGR.initialize(); + incidentGR.short_description = 'Critical system outage'; + incidentGR.description = 'All users are unable to access the core application. Immediate attention required.'; + incidentGR.impact = 1; // High + incidentGR.urgency = 1; // High + incidentGR.priority = 1; // P1 + incidentGR.category = 'network'; // Example category + incidentGR.assignment_group = 'NETWORK_SUPPORT'; // Replace with actual group sys_id or name + incidentGR.caller_id = gs.getUserID(); // Current user + incidentGR.insert(); + + gs.info('P1 Incident created: ' + incidentGR.number); +})(); From c44935ada8025f60b6f03b7588b98d4766558964 Mon Sep 17 00:00:00 2001 From: Thrizvi <145013431+Thrizvi@users.noreply.github.com> Date: Mon, 13 Oct 2025 12:25:58 +0530 Subject: [PATCH 2/2] Create Readme.md This script automates the creation of a **Priority 1 (P1)** Incident in ServiceNow. It is useful for testing, automation, or simulating critical incident scenarios. --- .../Create P1 Incident/Readme.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Create P1 Incident/Readme.md diff --git a/Server-Side Components/Background Scripts/Create P1 Incident/Readme.md b/Server-Side Components/Background Scripts/Create P1 Incident/Readme.md new file mode 100644 index 0000000000..65796a8495 --- /dev/null +++ b/Server-Side Components/Background Scripts/Create P1 Incident/Readme.md @@ -0,0 +1,35 @@ +# Create P1 Incident – ServiceNow Script + +This script automates the creation of a **Priority 1 (P1)** Incident in ServiceNow. It is useful for testing, automation, or simulating critical incident scenarios. + +## 🧩 Purpose + +To quickly generate a high-priority incident record with predefined values for urgency, impact, and description. + +## 🛠️ Script Details + +- **Table**: `incident` +- **Priority**: 1 (High Impact + High Urgency) +- **Fields Set**: + - `short_description`: "Critical system outage" + - `description`: Detailed explanation of the issue + - `impact`: 1 (High) + - `urgency`: 1 (High) + - `priority`: 1 (Calculated) + - `assignment_group`: Example group (`NETWORK_SUPPORT`) + - `caller_id`: Current logged-in user + +## ▶️ How to Use + +### Option 1: Background Script + +1. Navigate to **System Definition > Scripts - Background** +2. Paste the script +3. Run it + +### Option 2: Script Include + +Wrap the logic in a Script Include and call it from a Flow, Business Rule, or UI Action. + +## 🧪 Example Output +