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

Sandeep Rajput
Tera Patron
Tera Patron

@Suprun Dmytro Put the

new GlideArchiveRecord().archive(gr);

call in a script include defined in the Global Scope. Call that Global scrip include method from your scoped UI Action. 

Hi, @Sandeep Rajput yes, I have a script include inside my UI action as well and I am using: 

new GlideArchiveRecord().archive(gr);

chrome_eDjEJQLVek.png with the new syntax, but my script include created in my custom app, during the migration I can't include it in my application, this is the problem, can I have archive functionality from my app? Or extend any other script include from my app?

@Suprun Dmytro Since 

GlideArchiveRecord

is available in the Global Scope, you will not be able to call it from a scoped application. 

I got it, thank you for the answer! So how can I trigger archive functionality on demand in my scope app, keeping my app consistent? Are there any other ways?