Regarding Rollback deleted records by using condition created on
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi,
My question is how to retrieve the deleted records in incidents by using condition created on. But we need to use server side script like fix or background script, can you please give suggestion how to write script.
This is my script:
var del = new GlideRecord('sys_audit_delete');
del.addQuery('sys_updated_on', 'ON ', '2026 - 05 - 20 ');
del.query();
while (del.next()) {
var rollback = new GlideRollback();
rollback.rollbackSequence(del);
gs.print('Rolled back sequence: ' + del.sys_id);
}
gs.print(' Error Rolled back sequence: ' + del.sys_id);
can you please modify and update the script
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi @sivakumaraa
Try this:
Run the following script using Fix Scripts or Scripts - Background. Always test this in a non-production instance first.
Note: In script replace Var date as per the screen shot:
var del = new GlideRecord('sys_audit_delete');
var date = "sys_created_onON2026-05-20@javascript:gs.dateGenerate('2026-05-20,'start')@javascript:gs.dateGenerate('2026-05-20','end')";
del.addEncodedQuery(date);
del.query();
while(del.next())
{
new GlideAuditDelete().undelete(del.sys_id);
}