- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2018 09:39 AM
I was removing choices from a variable and there were 250+ choices, so I thought to use a script which ended up deleting everything from the table Question_choices.I've deleted all the 15K choices from Question_choices table mistakenly. When I checked for the restore option, I didn't find anything which can restore all the records in one go. I found this solution on another thread on the community:
Navigate to System Definition > Deleted Records.
- Open a deleted record that you want to restore.
Note: You can only restore one deleted record and its associatd references at a time.
- In the Audit Deleted Record form, select Restore Record and References under Related Links.
Note: To restore the record without restoring the references, select Undelete RecordI selected 100 records at a time in list view and restored everything. My question here is how can I do it in less time as restoring 15K records with this option took me 2 hours. Is there any other way we can do it.Note of caution - Please read all the follow-up comments before running the script from Correct Answer, as it has syntax error that may cause issues if you run without correcting it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2018 09:50 AM
I would say that you should stay away from scripts given what has happened...but...lessons aside: Try this in a background script...you'd need to fix your encodedquery to grab what you're looking for.
var deleted = new GlideRecord('sys_audit_delete');
deleted.addEncodedQeury('put query here');
deleted.query();
while(deleted.next()){
new GlideAuditDelete().undelete(deleted.sys_id);
}
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023 04:36 PM
@Sontel How did you resolve the issue when it restored all the records?
Is there an identifier which tells us what was restored
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 02:05 AM
'GlideAuditDelete' is not working for Scoped Application. Is there any alternative?
