I want to retire and make inactive all active article present in the knowledge base
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2024 10:08 PM
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2024 10:20 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2024 01:13 AM
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?