Skip to content

added knowledgebase auto publish script #1604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
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
7 changes: 7 additions & 0 deletions KBAutoPublish/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Custom Knowledge Base Auto-Publish

This script auto-publishes reviewed Knowledge Base articles, ensuring they are available to users without manual intervention.

## Usage
- This script is ideal for automating Knowledge Base publishing after an article passes review.
- Set up as a scheduled job to automate the process.
12 changes: 12 additions & 0 deletions KBAutoPublish/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(function autoPublishKnowledge() {
// Query for articles marked as ready for publishing
var kb = new GlideRecord('kb_knowledge');
kb.addEncodedQuery('workflow_state=reviewed^valid_to>javascript:gs.now()');
kb.query();

// Auto-publish articles
while (kb.next()) {
kb.workflow_state = 'published';
kb.update();
}
})();
Loading