- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 12:14 PM
Instead of going into each KB article and clicking the 'Retire' button, looking for a script to do it.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 12:20 PM
You can try to do this via a Background Script (see Background Scripts — ServiceNow Elite ).
The following retires ALL published KB articles. You may want to modify the query to specify the conditions for the KB articles that you do want to retire (if not all).
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('workflow_state','published');
gr.query();
while(gr.next()) {
gr.setValue('workflow_state','retired');
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 12:19 PM
Hi,
You can do it from list view , refer to below thread
http://wiki.servicenow.com/index.php?title=Editing_Lists or you can write a script to do a GlideRecord to this table and update the records based on conditions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 12:20 PM
You can try to do this via a Background Script (see Background Scripts — ServiceNow Elite ).
The following retires ALL published KB articles. You may want to modify the query to specify the conditions for the KB articles that you do want to retire (if not all).
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('workflow_state','published');
gr.query();
while(gr.next()) {
gr.setValue('workflow_state','retired');
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 01:56 PM
Does this work on Knowledge v3?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 01:59 PM
Yes. But you may need to modify the query and you should familiarize yourself with Background Scripts and the risks if you've never used before.