unable to remove article templates for particular knowledge base
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
I want to remove knowledge base article template for few knowledge bases, I have tried but not working.
when I click on Customer Service knowledge base, I have standard and Known Error article Templates. I want to remove Known Error article template, So when I click on Customer Service knowledge base, It needs to show only Standard article template only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Gopal14
This article provides you with how to add the article to a knowledge base, and in the same way, you can unlink it as well."
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Gopal14 ,
CC : @Dr Atul G- LNG ,
Go to "ArticleTemplateUtil" script include and copy this code.
Keep in mind, I define two variables in starting :
var ArticleTemplateUtil = Class.create();
ArticleTemplateUtil.prototype = Object.extendsObject(ArticleTemplateUtilSNC, {
getArticleTemplatesForKnowledgeBase: function(kbId, addNames) {
var KNOWN_ERROR_TEMPLATE_SYS_ID = '478034d4870023000e3dd61e36cb0b56';
var KB_SYS_ID = 'a7e8a78bff0221009b20ffffffffff17';
var gr = new GlideRecord('kb_template_m2m_knowledge_base');
gr.addQuery('kb_knowledge_base', kbId);
gr.query();
var templates = {};
// Always add Standard template
if (addNames)
templates['kb_knowledge'] = 'Standard';
else
templates['kb_knowledge'] = true;
if (!gr.hasNext()) {
var template = new GlideRecord('kb_article_template');
template.addActiveQuery();
template.query();
while (template.next()) {
// Skip Known Error template if IT KB
if (kbId == KB_SYS_ID && template.sys_id == KNOWN_ERROR_TEMPLATE_SYS_ID)
continue;
if (addNames)
templates[template.child_table] = template.getDisplayValue('article_template');
else
templates[template.child_table] = true;
}
} else {
while (gr.next()) {
if (gr.kb_article_template.active) {
// Skip Known Error template if IT KB
if (kbId == KB_SYS_ID && gr.kb_article_template.sys_id == KNOWN_ERROR_TEMPLATE_SYS_ID)
continue;
if (addNames)
templates[gr.kb_article_template.child_table] = gr.kb_article_template.getDisplayValue();
else
templates[gr.kb_article_template.child_table] = true;
}
}
}
return templates;
},
type: 'ArticleTemplateUtil'
});
I tried it on PDI, Removed "Known error article" template for "IT" knowledge Base.
Refer below screenshot :
If this helps, please consider marking my answer as helpful/accepted — it motivates me to stay active in the community and also helps others find relevant solutions more easily.
Thank you!
Shashank Jain – Software Engineer | Turning issues into insights
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Gopal14 ,
If the solution works, mark it as accepted and close the thread.
Shashank Jain – Software Engineer | Turning issues into insights
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Gopal14 ,
If the above solution helps, please mark it as accepted and close the thread.
Shashank Jain – Software Engineer | Turning issues into insights