Publishing the knowledge article through fix script
This content was last updated in 2024. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 06:27 AM
Hi All,
I have 2 versions are KB article one published and another needs to be published.
The ask is i need to publish the version 12.02 which is in the review state currently.
I did write a fix script code and put the sys id of the version 12.02. But still the article isn't getting published and is still in the review state.
Fix script code:
var kb = new GlideRecord("kb_knowledge");
kb.addEncodedQuery('72cdf9e9fbaf02108d2aff5eaeefdc48'); // change the article number
kb.query();
if(kb.next()){
kb.workflow_state="published";
kb.update();
kb.setWorkflow(false);
}
How to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 10:38 AM
Hi @phr
Try this , use serWorkflow(false) before the update if you wanna skip the workflow to trigger.
var kb = new GlideRecord("kb_knowledge");
kb.addEncodedQuery('72cdf9e9fbaf02108d2aff5eaeefdc48'); // change the article number
kb.query();
if(kb.next()){
kb.workflow_state="published";
kb.setWorkflow(false);
kb.update();
}
Hope this helps!!!