The CreatorCon Call for Content is officially open! Get started here.

Restore Archived Record using script in ServiceNow

Vamsi Krishna10
Tera Contributor

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.

 

 

1 ACCEPTED SOLUTION

Weird
Mega Sage

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.



View solution in original post

6 REPLIES 6

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

JLeong
Mega Sage

I can also use it to automatically restore via a catalog request.