- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 07:03 AM
Hello,
We create several Knowledge Bases on TEST instance and we would like to delete them.
How can we do that? I Don't find. Please, be precise I am a novice.
Thanks a lot,
Sandra
Solved! Go to Solution.
- Labels:
-
Knowledge Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 07:10 AM
Hi Sandra,
As admin, run a background script to delete the specific record (be careful in doing it in production, please do first in test environment):
Go to System Definition > Scripts - Background, copy and paste the following script, replace the SYSID of your Knowledge Base (see image below) and press Run script:
var kbase = new GlideRecord('kb_knowledge_base');
kbase.addQuery('sys_id', 'SYSID OF KB TO DELETE HERE'); // you can right click the kb record header to copy the sysID
kbase.query();
while (kbase.next()) {
kbase.deleteRecord();
}
Done!!! Enjoy 🙂
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2019 07:10 AM
Hi Sandra,
As admin, run a background script to delete the specific record (be careful in doing it in production, please do first in test environment):
Go to System Definition > Scripts - Background, copy and paste the following script, replace the SYSID of your Knowledge Base (see image below) and press Run script:
var kbase = new GlideRecord('kb_knowledge_base');
kbase.addQuery('sys_id', 'SYSID OF KB TO DELETE HERE'); // you can right click the kb record header to copy the sysID
kbase.query();
while (kbase.next()) {
kbase.deleteRecord();
}
Done!!! Enjoy 🙂
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2022 07:21 AM
This orphans the articles that were attached to it. Knowledge base is a required field on articles and this will decouple them and leave the KB article undefined for KB Base.
I typically do not like resurrecting 3 year old posts, but this was one of the first things that showed up in a Google search and want people to be aware the articles do not get re-attached to anything and some cleanup will need to be done. Ideally, you would attach them to another KB, perhaps specifically for review and cleanup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2022 06:23 PM
It's also bloated code. Could be as simple as
var kb = new GlideRecord('kb_knowledge_base');
kb.get('sys_id'); //enter sysid of Knowledge Base here
kb.deleteRecord();
As you suggest though, move any existing articles to a new KB before deleting it.
If there is a lot which require moving it could be done with something like this
var articles = new GlideRecord('kb_knowledge');
articles.addEncodedQuery('kb_knowledge_base=SYSID'); // Where SYSID is the sysid for the KB which is to be deleted
articles.query();
while(articles.next()) {
articles.kb_knowledge_base = 'SYSID'; // SYSID of the KB you wish to move the articles to
articles.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2022 10:00 PM
Hi James,
Thanks for your updates, I had a question that why can't we delete Knowledge base records directly, just like any other normal records?