- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 03:27 AM
Hello Everyone,
I have around 8700 restored records from knowledge table which needs to be archived again.
But while running a new Archive Rule I see below error message.
Running archive rule: Archiving older Knowledge Articles from KB V2. 9503 record(s) cannot be re-archived because they have been restored.
Can anyone please advise.
Regards,
Sagarika Das
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 04:09 AM
First of all, if it's a one time off, you shouldn't use a UI action for it. You should maybe create a scheduled script execution.
And you need to adapt your script a bit. Does this work for one record if you run it via background scripts?
var gr = new GlideRecord('ar_kb_knowledge');
gr.addQuery('kb_knowledge_base','dfc19531bf2021003f07e2c1ac0739ab');
gr.addQuery('dateGenerate','<','2017-01-01','12:00:00');
gr.addQuery('category','Planned Downtime');
gr.addOrCondition('category','Unplanned Downtime');
gr.setLimit(1);
gr.query();
while(gr.next()) {
gs.print('Archiving record with number: ' + gr.number);
try {
new GlideArchiveRecord().archive(gr);
}
catch(err) {
gs.log('Error returned is: ' + err);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2017 02:02 AM
Hi Sergiu,
This Make sense. However, what is the best way to do it. Also can you please advise on the script as well.
Regards,
Sagarika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2017 05:51 AM
If you want to run only once, the easiest way would be to create an Archive Rule on the table you want with the conditions you want, run the estimation to see how many records will be archived, and then click "Run archive now" link and that will trigger automatically a background archiver. In the meantime, disable scheduled job "Archive" so it won't trigger a second archiver. Once all records you want are archived, just deactivate the archive rule.
So, you don't really need a script here, can be done by just simply creating an archive rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 12:57 AM
Thanks Sergiu,
It seems like the Archive rule does not work on Restored records, I see below error.
Running archive rule: Archiving older Knowledge Articles from KB V2. 798 record(s) cannot be re-archived because they have been restored.
Regards,
Sagarika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 01:01 AM
Forgot these records have been archived and restored. Try using the script I provided before in background scripts with a
gr.setLimit(5);
and see if 5 records get re-archived.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 01:22 AM
Thanks Sergiu ,
My question was which script I should use to restore archived records?
Regards,
Sagarika