From 4223c2bead0dbac3bc021f8d43e1a81e9a1a592d Mon Sep 17 00:00:00 2001 From: Soumyadeep Dutta <78016846+Soumyadeep10@users.noreply.github.com> Date: Thu, 9 Oct 2025 21:29:11 +0530 Subject: [PATCH 1/2] Create README.md --- .../Fetch Recent Incidents and Assigned status/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/README.md diff --git a/Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/README.md b/Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/README.md new file mode 100644 index 0000000000..7b64d371e7 --- /dev/null +++ b/Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/README.md @@ -0,0 +1,8 @@ +This piece of code is designed to fetch 'N' number of incidents that are most rcently created along with their Assigned status. +This helps to flag potential adherence issues which might lead to customer dissatisfaction. + +What the code does: + +1. Fetches the N number of most recently created incidents and prints their 'Number', 'Created' on value and 'Assigned to' status. +2. The incidents which are Assigned have a value of 'Assigned'. +3. The incidents which are Unassigned have a value of '**NOT Assigned**'. From d081098472d8815c8ed727ed1b748ab2cee3dda5 Mon Sep 17 00:00:00 2001 From: Soumyadeep Dutta <78016846+Soumyadeep10@users.noreply.github.com> Date: Thu, 9 Oct 2025 21:31:36 +0530 Subject: [PATCH 2/2] Create fetchincidents.js --- .../fetchincidents.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/fetchincidents.js diff --git a/Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/fetchincidents.js b/Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/fetchincidents.js new file mode 100644 index 0000000000..c2efcc89ae --- /dev/null +++ b/Server-Side Components/Background Scripts/Fetch Recent Incidents and Assigned status/fetchincidents.js @@ -0,0 +1,14 @@ +var inc = new GlideRecord('incident'); +inc.orderByDesc('sys_created_on'); +inc.setLimit(15); +inc.query(); +gs.info('Below are the 15 most recently created incidents along with their Assigned status: '); +while (inc.next()) { + var assignedIncident = ''; + if (inc.assigned_to) { + assignedIncidentStatus = 'Assigned'; + } else { + assignedIncidentStatus = '**NOT Assigned**'; + } + gs.info('Number: ' + inc.number + ', Created on: ' + inc.sys_created_on + ', ' + assignedIncidentStatus); +}