We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de3ed58 commit 3206d0aCopy full SHA for 3206d0a
Core ServiceNow APIs/GlideRecord/Archiving Old Incident Records to Improve Performance/script.js
@@ -0,0 +1,14 @@
1
+var gr = new GlideRecord('incident');
2
+gr.addQuery('state', 7); // Closed
3
+gr.addQuery('active', false);
4
+gr.addQuery('closed_at', '<=', gs.daysAgo(150));
5
+gr.query();
6
+while (gr.next()) {
7
+ var ar = new GlideRecord('ar_incident'); //ar_incident is the new table for storing archive data
8
+ ar.initialize();
9
+ ar.short_description = gr.short_description;
10
+ ar.description = gr.description;
11
+ // Copy other necessary fields
12
+ ar.insert();
13
+ gr.deleteRecord(); // deleting from incident table if record in inserted in the archived table
14
+}
0 commit comments