- 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 01:15 PM
the easiest way is from a list view.. filter the list down to JUST the ones you want to retire... right click the header and select update all.. then select retired from the drop down and click update
this option is ONLY available to admins generally and is a VERY easy way to update a list of records... just make sure you have filtered the list first so you have ONLY the records you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2017 01:29 PM
Another method if you're planning on doing this sort of mass retirement on a regular basis, you can (or ask an admin to) make a copy via insert and stay of the "retire" UI action and have that be a list choice UI action (I would recommend using a copy so that you aren't customizing OOTB functionality and just adding functions). At that point you could then select the articles needing retiring in the list and select that list choice.
Just another way to do it, but I think you've got lots of options for it.