How to Retrieve large number of deleted records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:34 AM
Management asked me to deleted 10,000 Records and now they want them back.
I went to Deleted Records module and saw the records exist: but here, its hard to keep selecting 200 records at once and undelete the records.
Is there any other way to retrieve all those records at once?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:39 AM
you can build your query in a fix script and run it.
var deleted = new GlideRecord('sys_audit_delete');
deleted.addEncodedQeury('paste your query here from your breadcrumbs on the deleted table');
deleted.query();
while(deleted.next()){
new GlideAuditDelete().undelete(deleted.sys_id);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:44 AM
just know this code is untested and to always test on a subset of records in your non-prod environment
also this code restores the deleted record(s) but does NOT restore references or relationships
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 07:14 AM
LOOK OUT! WARNING!
Nate: your code has a typo, that will cause to restore all kinds of records, just not the one in the query.
Your code says: "addEncodedQeury"
Correct code is: "addEncodedQuery"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:41 AM
Restoring deleted records comes under Table Administration. There are several methods for restoring deleted records:
- Restore data records without references on tables that audit deletions.
- Restore data records and references on tables that audit deletions (requires the Restore Deleted Records plugin).
Check this link for details:
Please mark as Answered if your query is resolved.