Archive Rules

Anitha P
Tera Contributor

Hi,

Good Day!!

We need to run an Archive rules using scheduled jobs. And, already we have one scheduled item with the name "Archive". 

Script is already there in that scheduled item,

new GlideArchiver().archive();

By using this script, all the archive rules are running which are in Active.

But, here we need to run only "Incident" and "Request" Archive rules. those 2 archive rules are also already there in the system. Which is OOB. we need to archive the records, which are closed over 4 years ago.

We have tried incident rule with one script

var gr = new GlideRecord('incident');

gr.query();

while(gr.next())

{

new GlideArchiver().archive(gr);

}

But, it is not archiving any records. Any one can help me with this?

With Regards,

Anitha P.

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

there is no reason to script anything as you can configure all rules with no code. See https://docs.servicenow.com/en-US/bundle/sandiego-platform-administration/page/administer/database-r...

And ServiceNow cares about the rest.

Maik

@Maike , Is there any way to trigger archive rule in scoped application.

Regards,
Lithesh.B