Skip to content

Commit 1f10ac4

Browse files
authored
Create publishretiredkb.js
1 parent 16278cd commit 1f10ac4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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);

0 commit comments

Comments
 (0)