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,2 @@
Description:
This background script is used to automatically update the content of all published Knowledge Base articles by replacing outdated group references, ensuring consistency and relevance across documentation without the need to manually check out and edit each article
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var old_reference = "Service desk"; // Old group name
var new_reference = "Help desk"; // New group name

var regexPattern = new RegExp('(?is)'+ old_reference, 'gi'); // Building Regex to generate case-insensitive pattern

var kb_article = new GlideRecord('kb_knowledge');
kb_article.addEncodedQuery('workflow_state=published');
kb_article.query();
while(kb_article.next()){
kb_article.text = kb_article.text.replace(regexPattern,new_reference); // Replacing the old group reference with the new group
kb_article.setWorkflow(false);
kb_article.update();
gs.info('Updated Article: ' + kb_article.number);
}
Loading