How to Retired a Knowledge Article that hasn't been Published

carlav
Kilo Guru

We have a ton of knowledge articles submitted over a year when there was no Knowledge Manager processing submissions

What is the best way to retire, or make them inactive/closed out if they were never Published but are not valid now? Do we have to Publish and then Retire?

find_real_file.png

5 REPLIES 5

shloke04
Kilo Patron

Hi @carlav 

Want to add that along with Draft, suggestion here will be to also consider only those articles whose Valid to date is in past as mentioned in your query as well.

My version of script will be to look at Articles which are not Published and whose Valid to date is in past then make those articles as retired.

Please write a Fix Script and use the script as below:

Also do make use of setworkflow as false to avoid any unnecessary Notification from getting triggered when you are updating these articles.

retireArticles();

function retireArticles(){
	var gr = new GlideRecord('kb_knowledge');
	gr.addEncodedQuery('sys_class_name!=kb_knowledge_block^workflow_state!=published^valid_to<javascript:gs.beginningOfToday()');
	gr.query();
	while(gr.next()){
		gr.workflow_state = 'retired';
		gr.setWorkflow(false);
		gr.update();
	}
}

Screenshots for reference:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke