- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 05:02 AM
Hi All,
I Have knowledge version plugin enabled, to create knowledge version we basically use OOB UI action, but now that need is, i have a condition to retire an article and now once the article gets retired versioning need to be created automatically with out clicking UI action.
Needed help on how this can be implemented.
Thanks
Jagruthi.J
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018 08:42 AM
Hi Sachin,
Thanks
But i achieved it through schedule job based on some other field date, using the same script as of checkout ui action by calling the script include.
worked like this.
var dt = new GlideDate();
dt.getByFormat("MM-dd-yyyy");
var tb = new GlideRecord('kb_knowledge');
tb.addQuery('workflow_state', 'published');
tb.addQuery('published', dt);
tb.query();
while(tb.next()){
var newRecord = new KBVersioning().checkout(tb);
gs.log("newRecord:"+newRecord);
if(newRecord){
gs.addInfoMessage(gs.getMessage("A new version of the article is created for revision."));
//action.setRedirectURL(newRecord);
tb.update();
}
else
gs.addErrorMessage(gs.getMessage("You cannot checkout this article as it is already checked out."));
}
Regards,
Jagruthi.J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 04:25 PM
Hi,
Not sure what you are after here. Do you want a new version to be created for retiring?
//Göran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 04:39 PM
You can create business rule to create new kb article versioning after kb article is retired.
You can use below sample code to create new version.
if(new KBKnowledge().canPublish(current)){
var prevValue = current.workflow_state + '';
if (current.kb_knowledge_base.kb_version == "3" && new KBWorkflow().startWorkflow(current, "workflow")) {
//If publish sub workflow is completed, workflow engine would have already done current.update()
if(current.workflow_state!='published')
current.update();
var knowledge = new GlideRecord("kb_knowledge");
if(knowledge.get(current.sys_id) && prevValue != knowledge.getValue("workflow_state")){
gs.addInfoMessage(new KBKnowledge().getStateMessage(knowledge.getValue("workflow_state")));
}
} else if (current.kb_knowledge_base.kb_version == "2") {
current.workflow_state = 'published';
current.update();
gs.addInfoMessage(new KBKnowledge().getStateMessage(current.getValue("workflow_state")));
}
}
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2018 05:04 AM
but... why create a new version if it's retired? make no sense... Totally against OOB functionality and how it works...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2018 07:38 PM
Minor revisions include updates to an article that has not yet been published. Major revisions include updates to an article that has been published and is available to customers.
This is how article versioning works OOB.You can always update minor version which isn't published yet.
Author here is asking about ways to achieve custom functionality for publishing KB article.
Regards,
Sachin