- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:42 AM
Does anyone know a good way to avoid the creation of duplicate KBs from incidents? Looking to eliminate the issue of having multiple KBs for the same type of incident. Any suggestions are appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:47 AM - edited 05-14-2024 06:51 AM
Hi @RimaC ,
You will need to create a before insert business rule which check for the subject and other conditons which checks for duplicate KB creation and avoid the insertion and trow an error with an insert abort action.
(function executeRule(current, previous /*null when async*/) {
var incidentShortDesc = current.getValue('short_description'); //considering short_desr to be the key , you can use any fieldwhich you wanted to check
var kbArticleGr = new GlideRecord('kb_knowledge');
kbArticleGr.addQuery('short_description', incidentShortDesc);
kbArticleGr.query();
if (kbArticleGr.hasNext()) {
gs.addErrorMessage('A knowledge article with the same short description already exists.');
current.setAbortAction(true);
}
})(current, previous);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:47 AM - edited 05-14-2024 06:51 AM
Hi @RimaC ,
You will need to create a before insert business rule which check for the subject and other conditons which checks for duplicate KB creation and avoid the insertion and trow an error with an insert abort action.
(function executeRule(current, previous /*null when async*/) {
var incidentShortDesc = current.getValue('short_description'); //considering short_desr to be the key , you can use any fieldwhich you wanted to check
var kbArticleGr = new GlideRecord('kb_knowledge');
kbArticleGr.addQuery('short_description', incidentShortDesc);
kbArticleGr.query();
if (kbArticleGr.hasNext()) {
gs.addErrorMessage('A knowledge article with the same short description already exists.');
current.setAbortAction(true);
}
})(current, previous);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 08:59 AM
Thank you @Sohail Khilji - we will explore that.