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); 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.