Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

GlideArchiveRecord is not allowed in scoped applications

Suprun Dmytro
Tera Contributor

Hi, I have created an Archive rule for my custom table "x_....." and auto-created "ar_x_.....". I want to trigger the archive with my archive button on the record form. UI Action contains:

 

 

new GlideArchiveRecord().archive(gr);

 

 

I have received this error. How can I get archive functionality on demand in another way in my scoped app? Please advise.

 

chrome_AWXqXzMOiQ.png

 

 

 

6 REPLIES 6

@Suprun Dmytro There are few options to achieve this.

Approach 1: Instead of using GlideArchiveRecord, use GlideRecord and manually move data from Main table to Archive table

 

OR

 

Approach 2:. Use a combination of a custom event and a Script Action defined in the Global scope. Trigger the event with a glide record object in your custom app, and inside your Script action (which will be in the Global scope) use

new GlideArchiveRecord().archive(gr);

 

Hope this helps.

 

@Sandeep Rajput  I am interested in Approach 1 to keep all the development in my custom app, can you suggest how the code in the "Archive" UI Action should look like for coping from "x_....." and auto-created "ar_x_.....". because I didn't get the exact approach, can you help me with that? You can use the incident or requested item as an example, thank you for your assistance.