File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ This Job will look for articles which have been rated 1 three times and will ret
66var kbFeed = new GlideAggregate ( 'kb_feedback' ) ;
77kbFeed . addEncodedQuery ( 'rating=1' ) ; // get articles with rating 1.
88kbFeed . addAggregate ( 'COUNT' , 'article' ) ;
9- kbFeed . groupBy ( 'user ' ) ;
9+ kbFeed . groupBy ( 'article ' ) ;
1010kbFeed . query ( ) ;
1111while ( 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 }
You can’t perform that action at this time.
0 commit comments