
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 01:32 PM
When users select the "Create Article" button, they must select the knowledge base and then the appropriate template. If they click the left hand menu "Create New" the active templates are shown.
We have removed Standard from the interceptors so we can use a "Default" template instead. However the "Standard" template is still shown on the "Create Article" template options. (see below). How do I deactivate/remove it as an option
Alternately, could we just make the "Create Article" button default to the same screen as the "Create New" menu option
Solved! Go to Solution.
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2020 03:44 AM
Hi
I found a way to fix this. If you are still looking for a possible way then you may try below.
1. Open "ArticleTemplateUtil" script include and paste the below code.
var ArticleTemplateUtil = Class.create();
ArticleTemplateUtil.prototype = Object.extendsObject(ArticleTemplateUtilSNC,{
getTemplatesDataForKB: function()
{
var kbId = this.getParameter("sysparm_kbid");
var templates = this.getCanContributeTemplatesListCustom(kbId);
var result = {
templates: templates,
kb: kbId
};
return JSON.stringify(result);
},
getCanContributeTemplatesListCustom: function(kbId){
var kbGr = new GlideRecord('kb_knowledge_base');
if(kbGr.get(kbId) && SNC.KnowledgeHelper.canContribute(kbGr))
return this.getArticleTemplatesForKnowledgeBaseCustom(kbId,false);
else
return {};
},
getArticleTemplatesForKnowledgeBaseCustom: function(kbId, addNames){
var gr = new GlideRecord('kb_template_m2m_knowledge_base');
gr.addQuery('kb_knowledge_base',kbId);
gr.query();
var templates = {};
// if(addNames)
// templates['kb_knowledge'] = gs.getMessage('Standard');
// else
//templates['kb_knowledge'] = true;
if(!gr.hasNext()){
var template = new GlideRecord('kb_article_template');
template.addActiveQuery();
template.query();
while(template.next()){
if(!addNames)
templates[template.child_table] = template.getDisplayValue('article_template');
// else
// templates[template.child_table] = true;
}
return templates;
}
else {
while(gr.next()){
if(gr.kb_article_template.active){
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'
});
in "kb_knowledge_create" UI page and 60th line of client script is getting list of available templates via GlideAjax. So, I tried by overriding the method "getTemplatesDataForKB" in ArticleTemplateUtil script include as base system script include ArticleTemplateUtilSNC is readonly and protected.
You may tweak the code as just thought of sharing what I have tried for a similar use case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2020 05:44 AM
Hi
ArticleTemplateUtil is available in System UI --> Script Includes.
we can't edit "ArticleTemplateUtilSNC" as it is protected and made read-only. That's why servicenow provided another script include "ArticleTemplateUtil" which we can modify as per our requirement.
If you look at "ArticleTemplateUtil" script include, it will call "ArticleTemplateUtilSNC" script include.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 12:26 PM
This worked perfectly, THANK YOU!!!