
- 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
11-27-2019 10:56 AM
Sorry, I double checked it in my PDI, that page knowledge_home_launcher.do is back-end code. Unfortunately, there's no way to remove Create an Article button.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2019 01:21 AM
Any update on this?
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2019 08:13 AM
I guess I don't feel comfortable marking "It can't be done" as the correct answer. I was hoping someone else might have another answer. I understand that this may be the case but was leaving open with the hope of another answer or confirmation.
- 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-14-2020 07:13 AM
Thank you for this great idea. Please excuse my lack of experience. Where do I find the ArticleTemplateUtil script? I looked in UI Scripts and Client Scripts.
Also, I have no experience coding in Ajax, how would I include the Base script ArticleTemplateUtilSNC?
Thank you for your help and patience.