I want to retire and make inactive all active article present in the knowledge base

laptop1
Tera Contributor

Hi,

I want to retire and inactive all the article present in one knowledge base. However i don't want to inactive the knowledge base only the article entries.

I saw a possible solution by creating schedule job as per the community suggestion below

https://www.servicenow.com/community/itsm-forum/make-a-knowledge-article-inactive-if-it-has-no-activ...

For already retired article archive and archive destroy rule is using .

Any other possible configuration or scripted way to inactive article entry please suggest best one 

Thanks in Advance 

2 REPLIES 2

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @laptop1 

 

Navigate to Fix Scripts:

Go to System Definition > Fix Scripts in your ServiceNow instance.

 

 

 

 Create a New Fix Srcipt:

 

    var gr = new GlideRecord('kb_knowledge');

    gr.addQuery('workflow_state', 'published'); // Retire only published articles

    gr.addEncodedQuery('your query'); // Filter by specific KB, remove if retiring from all KBs

    gr.query();

 

    var count = 0;

    while (gr.next()) {

        gr.workflow_state = 'retired'; // Set state to 'retired'

        gr.update(); // Update the record

        count++;

    }

    gs.print('Fix script completed. Retired ' + count + ' articles.');

})()

 

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra  

Thanks for the response. Actually not only need to retire the knowledge article but also What all depend on the knowledge base need to archive. Can we use archive rule in knowledge base and archive all the records depend on the knowledge base?