- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 12:32 AM
Dear Community,
How to restore a archived record using scripting in ServiceNow? I didn't find any dedicated documentation related to restore archive records API's.
Tried: new GlideArchiveRestore().restore(object.sys_id); but no luck.
Please, let me know if we have any alternate API's which are working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 01:20 AM
I'd imagine GlideArchiveRestore would work, since it's what the Restore record ui action uses.
What does your object contain?
The actual UI action on the archive table restores the record based on the sys_archive_log record, so you'd have to make sure you're using that sys_id and not the one from the archive table.
So,
new GlideArchiveRestore().restore(current.sys_id);
Current in current.sys_id is in sys_archive_log table
Make sure you're not using sys_id from "ar_sc_request" for example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 01:51 AM - edited 04-14-2023 01:51 AM
I have a use case where a lot of records were archived using an incomplete conditioned archive rule, so we would very much like to "un-archive" 1.600.000 record, so any input on how to obtain this using a background/fix-script would be much apreciated.
Br. Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 08:53 AM
I can also use it to automatically restore via a catalog request.