Skip to content

Commit 3c894e5

Browse files
authored
Update script.js
1 parent 92838fb commit 3c894e5

File tree

1 file changed

+4
-4
lines changed
  • Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles

1 file changed

+4
-4
lines changed

Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ This Job will look for articles which have been rated 1 three times and will ret
66
var kbFeed = new GlideAggregate('kb_feedback');
77
kbFeed.addEncodedQuery('rating=1'); // get articles with rating 1.
88
kbFeed.addAggregate('COUNT', 'article');
9-
kbFeed.groupBy('user');
9+
kbFeed.groupBy('article');
1010
kbFeed.query();
1111
while (kbFeed.next()) {
1212

13-
if (kbFeed.getAggregate('COUNT', 'article') >= 3) {
13+
if (kbFeed.getAggregate('COUNT', 'article') >= 3) { // check if article is rated 1 three times
1414
var updateArt = new GlideRecord('kb_knowledge');
1515
updateArt.get(kbFeed.article.sys_id);
16-
if (updateArt.workflow_state == 'published') {
17-
updateArt.workflow_state = 'retired';
16+
if (updateArt.workflow_state == 'published') { //check if article is published
17+
updateArt.workflow_state = 'retired'; // retire the article
1818
updateArt.update();
1919
}
2020
}

0 commit comments

Comments
 (0)