- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 12:57 AM
We have a requirement to delete the draft version of thousands of KBs, Looking for a script for the same.
In the data, We have KB number & version number & workflow=draft.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 06:33 AM
This script will delete all Knowledge articles where state/workflow = draft. Please test out in subprod first. I would also suggest using this in a fix script and run it in the background.
var kb = new GlideRecord('kb_knowledge');
kb.addEncodedQuery('workflow_state=draft');
kb.setWorkflow(false);
kb.deleteMultiple(); //Deletes all records in the record set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 06:33 AM
This script will delete all Knowledge articles where state/workflow = draft. Please test out in subprod first. I would also suggest using this in a fix script and run it in the background.
var kb = new GlideRecord('kb_knowledge');
kb.addEncodedQuery('workflow_state=draft');
kb.setWorkflow(false);
kb.deleteMultiple(); //Deletes all records in the record set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 11:42 PM
thanks Mike_R.