Skip to content

Commit 8cd697c

Browse files
authored
Filter records with attachments (#1662)
1 parent f5784bb commit 8cd697c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//GlideRecord the [incident] table and fetching all the active incident records having attachments
2+
3+
var incWithAttachment = [];
4+
var checkAttachments = new GlideRecord('incident');
5+
checkAttachments.addActiveQuery();
6+
checkAttachments.query();
7+
while (checkAttachments.next()) {
8+
if (checkAttachments.hasAttachments()) {
9+
incWithAttachment.push(checkAttachments.number.toString());
10+
}
11+
}
12+
gs.info("Incident Records having attachment: " + incWithAttachment);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
GlideRecord in the [incident] table and fetching all the active incident records which are having attachments
2+
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.
3+
4+
5+
Background Script:
6+
7+
8+
<img width="866" height="368" alt="image" src="https://github.com/user-attachments/assets/ad9b5652-cb2f-48ac-813d-c250d334b617" />
9+
10+
11+
Output:
12+
13+
14+
<img width="638" height="132" alt="image" src="https://github.com/user-attachments/assets/16f1f34c-14d6-456c-8063-5d01d70c4ca4" />
15+
16+
17+
18+
19+
Note: The output may vary based on the records present on the target audience's instance.

0 commit comments

Comments
 (0)