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); +})(); 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 +