File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Client-Side Components/UI Actions/Publish a Retired Knowledge Article again Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ ** UI Action** :
2+ Publish a Retired Knowledge Article again after it is already retired.
3+
4+ ** How it works:**
5+ 1 . The code finds existing articles in the Knowledge base that share the same Article ID but are not the current article and are 'retired'.
6+ 2 . It updates the workflow state of these found articles to 'outdated'.
7+ 3 . For the current article, it sets the workflow_state to 'pubblished', records the current date and updates the 'published' field with the date.
8+ 4 . It also removes the pre-existing 'retired' date from the 'retired' field.
9+ 5 . It redirects the user to the updated current record.
Original file line number Diff line number Diff line change 1+ var kbArticle = new GlideRecord ( 'kb_knowledge' ) ;
2+ kbArticle . setWorkflow ( false ) ;
3+ kbArticle . addQuery ( 'article_id' , current . article_id ) ;
4+ kbArticle . addQuery ( 'sys_id' , "!=" , current . sys_id ) ; //articles that are not the current one
5+ kbArticle . addQuery ( 'workflow_state' , 'retired' ) ;
6+ kbArticle . query ( ) ;
7+ while ( kbArticle . next ( ) ) {
8+ kbArticle . workflow_state = 'outdated' ; //setting the articles as outdated
9+ kbArticle . update ( ) ;
10+ }
11+ current . workflow_state = 'published' ; //publishing retired kb article again
12+ current . published = new GlideDate ( ) ;
13+ current . retired = "" ; //clearing retired field value
14+ current . update ( ) ;
15+ action . setRedirectURL ( current ) ;
You can’t perform that action at this time.
0 commit comments