Hide Standard Template option for my Custom knowledge Bases

Nikita Nikita
Tera Contributor

Hi,

I have created one article template and I want to show that as only option to create knowledge. For example my knowledge base is New Product and I have created Product Knowledge as an article template.

I want Product Knowledge to be the only template for New Product Knowledge Base.

7 REPLIES 7

i have the same requirement.  @Nikita Nikita  did you manage to achieve it?

MattSN
Mega Sage
Mega Sage

One way to allow for the standard template to be selective is adding the function "getArticleTemplatesForKnowledgeBase" to the ArticleTemplateUtil script include and query/specify which KB's should include the standard template.


This could be improved to call a property or decision table.

  getArticleTemplatesForKnowledgeBase: function(kbId, addNames) {
        var gr = new GlideRecord('kb_template_m2m_knowledge_base');
        gr.addQuery('kb_knowledge_base', kbId);
        gr.orderBy('kb_article_template');
        gr.query();

//customized block starts here
        var templates = {};
        if (addNames) {
            var grKB = new GlideRecord('kb_knowledge_base');
            if (grKB.get(kbId)) {
                var title = grKB.title.toString();
                if (title.includes('IT') || title.includes('Customer')) {
                    templates['kb_knowledge'] = gs.getMessage('Standard');
                }
            }
        }
//customized block ends here 
 
       if (!gr.hasNext()) {
            var template = new GlideRecord('kb_article_template');
            template.addActiveQuery();
            template.orderBy('article_template');
            template.query();
            while (template.next()) {
                if (addNames)
                    templates[template.child_table] = this._getFieldLabelInUserLang(template.child_table, null, 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] = this._getFieldLabelInUserLang(gr.kb_article_template.child_table, null, gr.kb_article_template.getDisplayValue());
                    else
                        templates[gr.kb_article_template.child_table] = true;
                }
            }
        }
        return templates;
    },

 

Aniko Hegedus
Tera Expert

Hello,

You can disable the standard article template by opening sys_wizard_answer table and filtering for Question = Article template selector and then disabling "Standard".

Aniko