Skip to content
Closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**How to use**
1. This scheduled job will run according to the frequency, mostly daily EOD.
2. This will look for articles rated one, 3 or more than 3 times and will retire them.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
This schedule job will run daily EOD PST time.
This Job will look for articles which have been rated 1 three times and will retire those articles.

*/
var kbFeed = new GlideAggregate('kb_feedback');
kbFeed.addEncodedQuery('rating=1'); // get articles with rating 1.
kbFeed.addAggregate('COUNT', 'article');
kbFeed.groupBy('article');
kbFeed.query();
while (kbFeed.next()) {

if (kbFeed.getAggregate('COUNT', 'article') >= 3) { // check if article is rated 1 three times
var updateArt = new GlideRecord('kb_knowledge');
updateArt.get(kbFeed.article.sys_id);
if (updateArt.workflow_state == 'published') { //check if article is published
updateArt.workflow_state = 'retired'; // retire the article
updateArt.update();
}
}
}
Loading