From a0b135c7aca1987465740771757ddc4623496865 Mon Sep 17 00:00:00 2001 From: SrijanPatwa <148682493+SrijanPatwa@users.noreply.github.com> Date: Wed, 1 Oct 2025 20:05:17 +0530 Subject: [PATCH 1/2] incHavingAttachments.js Fetching all the active incident records which are having attachments and storing it in an array --- .../incHavingAttachments.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Get Array of Records with Attachments/incHavingAttachments.js diff --git a/Server-Side Components/Background Scripts/Get Array of Records with Attachments/incHavingAttachments.js b/Server-Side Components/Background Scripts/Get Array of Records with Attachments/incHavingAttachments.js new file mode 100644 index 0000000000..c0c016c7d3 --- /dev/null +++ b/Server-Side Components/Background Scripts/Get Array of Records with Attachments/incHavingAttachments.js @@ -0,0 +1,12 @@ +//GlideRecord the [incident] table and fetching all the active incident records having attachments + +var incWithAttachment = []; +var checkAttachments = new GlideRecord('incident'); +checkAttachments.addActiveQuery(); +checkAttachments.query(); +while (checkAttachments.next()) { + if (checkAttachments.hasAttachments()) { + incWithAttachment.push(checkAttachments.number.toString()); + } +} +gs.info("Incident Records having attachment: " + incWithAttachment); From 134f0bb800c7f7674147ab154817c7073c120f05 Mon Sep 17 00:00:00 2001 From: SrijanPatwa <148682493+SrijanPatwa@users.noreply.github.com> Date: Wed, 1 Oct 2025 20:10:21 +0530 Subject: [PATCH 2/2] readme.md --- .../readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Get Array of Records with Attachments/readme.md diff --git a/Server-Side Components/Background Scripts/Get Array of Records with Attachments/readme.md b/Server-Side Components/Background Scripts/Get Array of Records with Attachments/readme.md new file mode 100644 index 0000000000..6aadb8573b --- /dev/null +++ b/Server-Side Components/Background Scripts/Get Array of Records with Attachments/readme.md @@ -0,0 +1,19 @@ +GlideRecord in the [incident] table and fetching all the active incident records which are having attachments +and storing it in an array. This script will help to filter out incidents with attachments and based on that we can perform other actions as per the need. + + +Background Script: + + +image + + +Output: + + +image + + + + +Note: The output may vary based on the records present on the target audience's instance.