Skip to content

Commit 99b9a19

Browse files
authored
Add background script to retire IT Knowledge Base articles (#2013)
* Retire Articles.js This code will help to retire the knowledge articles in bulk. * Readme.md Added a background script to automatically retire all published Knowledge Articles related to the IT Knowledge Base, ensuring outdated or irrelevant IT content is properly archived and improving overall knowledge base hygiene. * Retire Articles.js
1 parent e3a3a32 commit 99b9a19

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Retire IT Knowledge Base Articles - Background Script
2+
3+
## 📘 Overview
4+
This ServiceNow **Background Script** is designed to automatically retire all Knowledge Articles associated with the **IT Knowledge Base** (`kb_knowledge_base` = "IT").
5+
6+
It helps administrators clean up outdated or inactive articles in bulk, ensuring that end-users can only access relevant and up-to-date IT knowledge content.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var article = new GlideRecord("kb_knowledge");
2+
article.addQuery("workflow_state","published");
3+
article.addQuery("kb_knowledge_base","a7e8a78bff0221009b20ffffffffff17") // Sys ID of the IT Knowledge base. You can provide the sys Id of any knowledge base.
4+
article.query();
5+
while(article.next()){
6+
article.workflow_state = "retired";
7+
article.update();
8+
}

0 commit comments

Comments
 (0)