diff --git a/Server-Side Components/Background Scripts/Fetch P1 active records/P1 Incident which are Active b/Server-Side Components/Background Scripts/Fetch P1 active records/P1 Incident which are Active new file mode 100644 index 0000000000..47056ebbd7 --- /dev/null +++ b/Server-Side Components/Background Scripts/Fetch P1 active records/P1 Incident which are Active @@ -0,0 +1,13 @@ + + var gr = new GlideRecord('incident'); + gr.addQuery('active', true); + gr.addQuery('priority', 1); // P1 + gr.query(); + + var count = 0; + while (gr.next()) { + gs.info('Active P1 Incident: ' + gr.number + ' | Short Description: ' + gr.short_description); + count++; + } + + gs.info('Total Active P1 Incidents Found: ' + count); diff --git a/Server-Side Components/Background Scripts/Fetch P1 active records/Readme.md b/Server-Side Components/Background Scripts/Fetch P1 active records/Readme.md new file mode 100644 index 0000000000..5dc2067f1c --- /dev/null +++ b/Server-Side Components/Background Scripts/Fetch P1 active records/Readme.md @@ -0,0 +1,22 @@ +# Fetch Active P1 Incidents – ServiceNow Background Script + +This script retrieves all **active incidents** with **Priority 1 (P1)** from the ServiceNow `incident` table. It is useful for monitoring critical issues that are still unresolved. + +## 🧩 Purpose + +To identify and list all high-priority incidents that are currently active, enabling quick review and escalation if needed. + +## 🛠️ Script Details + +- **Table**: `incident` +- **Filters Applied**: + - `active = true` + - `priority = 1` (P1) + +## ▶️ How to Use + +1. Navigate to **System Definition > Scripts - Background** +2. Paste the script into the editor +3. Click **Run Script** + +## 🧪 Example Output