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

sachin_namjoshi
Kilo Patron
Kilo Patron

You can configure  and run a fix script to updates these kb articles as retired.

Below is the sample script which retires KB articles.

 

var gr = new GlideRecord('kb_knowledge');


gr.addQuery('workflow_state','draft');


gr.query();


while(gr.next()) {


         gr.setValue('workflow_state','retired');


         gr.update();


}

 

Regards,

Sachin

So we would go through and Publish what we want and leave all in Draft we don't and then run this script (it would run on all in Draft state), is that correct?

Yes, this script will run for draft state knowledge articles.

 

 

Regards,

Sachin

Musab Rasheed
Tera Sage
Tera Sage

Hello Carlav,

Please write fix script but make sure you log count and cross check how many where there and also don't forgot to add gr.setWorkflow(false) otherwise it will trigger notifications and all and lastly run fix script in background, that option will come once you click on 'Run fix script' button. Mark my answer as correct or hit like based on impact.

var count = 0;

var gr = new GlideRecord('kb_knowledge');


gr.addQuery('workflow_state','draft');


gr.query();


while(gr.next()) {


        count++;

         gr.workflow_state = 'retired';
         gr.setWorkflow(false);
         gr.update();


}
gs.print("Total number of article moved to Retired state is: " + count);
Please hit like and mark my response as correct if that helps
Regards,
Musab