Restore attachments related to incidents
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 09:00 PM
We are currently restoring approximately 50,000 incidents from the ar_incident table. However, we have noticed that the attachments associated with these incidents have not been restored. We need the attachments for these 50,000 incidents to be restored as well.
var arInc = new GlideRecord("ar_incident");
arInc.addEncodedQuery("assignment_groupLIKEABCD");
arInc.orderBy('sys_updated_on');
//arInc.setLimit(1);
arInc.query();
while (arInc.next()) {
gs.log("Incident insert " + arInc.number, 'Incident Restore');
var archiveGR = new GlideRecord('sys_archive_log');
archiveGR.addQuery('id', arInc.sys_id);
archiveGR.query();
while (archiveGR.next()) {
new GlideArchiveRestore().restore(archiveGR.sys_id);
}
gs.log("Incident" + arInc.number, 'Incident Restore');
}
This is code we are using for restoring the records.
0 REPLIES 0