File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ This schedule job will run daily EOD PST time.
3+ This Job will look for articles which have been rated 1 three times and will retire those articles.
4+
5+ */
6+ var kbFeed = new GlideAggregate ( 'kb_feedback' ) ;
7+ kbFeed . addEncodedQuery ( 'rating=1' ) ; // get articles with rating 1.
8+ kbFeed . addAggregate ( 'COUNT' , 'article' ) ;
9+ kbFeed . groupBy ( 'user' ) ;
10+ kbFeed . query ( ) ;
11+ while ( kbFeed . next ( ) ) {
12+
13+ if ( kbFeed . getAggregate ( 'COUNT' , 'article' ) >= 3 ) {
14+ var updateArt = new GlideRecord ( 'kb_knowledge' ) ;
15+ updateArt . get ( kbFeed . article . sys_id ) ;
16+ if ( updateArt . workflow_state == 'published' ) {
17+ updateArt . workflow_state = 'retired' ;
18+ updateArt . update ( ) ;
19+ }
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments