- 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
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
03-16-2023 02:22 AM
Hi Joni,
Will it work for scoped application as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 03:35 AM
Probably if you add global to the call -> new global.GlideArchiveRestore().restore(current.sys_id);
You might need to add some cross scope priviledges if there are none yet.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 01:29 AM