Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**UI Action**:
Publish a Retired Knowledge Article again after it is already retired.

**How it works:**
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'.
2. It updates the workflow state of these found articles to 'outdated'.
3. For the current article, it sets the workflow_state to 'pubblished', records the current date and updates the 'published' field with the date.
4. It also removes the pre-existing 'retired' date from the 'retired' field.
5. It redirects the user to the updated current record.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var kbArticle = new GlideRecord('kb_knowledge');
kbArticle.setWorkflow(false);
kbArticle.addQuery('article_id', current.article_id);
kbArticle.addQuery('sys_id', "!=", current.sys_id); //articles that are not the current one
kbArticle.addQuery('workflow_state', 'retired');
kbArticle.query();
while (kbArticle.next()) {
kbArticle.workflow_state = 'outdated'; //setting the articles as outdated
kbArticle.update();
}
current.workflow_state = 'published'; //publishing retired kb article again
current.published = new GlideDate();
current.retired = ""; //clearing retired field value
current.update();
action.setRedirectURL(current);
Loading