How to remove standard from the article template in newyork?

Rahul Gupta
Tera Contributor

I wanted to remove the standard option from the select article template under knowledge category .

find_real_file.png

Please help me .!!

1 ACCEPTED SOLUTION

JayGervais
Kilo Sage

Hi @Rahul Gupta, I'm not sure if you are still having issues with this but I was also having trouble with this and managed to find a working solution. 

Within the ArticleTemplateUtil script include, you can add a method that overrides the getArticleTemplatesForKnowledgeBase method in the ArticleTemplateUtilSNC script.

Within the ArticleTemplateUtil script, the code is as follows:

var ArticleTemplateUtil = Class.create();
        ArticleTemplateUtil.prototype = Object.extendsObject(ArticleTemplateUtilSNC,{
			
			// script override to disable Standard KB template
			getArticleTemplatesForKnowledgeBase: 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'] = 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'
        });

Hopefully this helps.

Regards,

Jay

View solution in original post

10 REPLIES 10

RudhraKAM
Tera Guru

go to Knowledge > Administration > Article Templates. and set the active to false for standard 

 

 

 

Mark correct if this helps

Standard isn't an option there. You could do this in the old view by editing the interceptor but can't in NY+

Krishna  Penaka
Tera Expert

Hi,

Deactivating knowledge article templates :

You cannot delete an article template because article templates have an associated child table. Deleting a template would also require deleting the child table. Due to the limitations on dropping tables, article templates and template columns are explicitly made non-deletable. Instead you can disable the Knowledge Article Templates feature by clearing the Active check box on the Article Template form.

JayGervais
Kilo Sage

Hi @Rahul Gupta, I'm not sure if you are still having issues with this but I was also having trouble with this and managed to find a working solution. 

Within the ArticleTemplateUtil script include, you can add a method that overrides the getArticleTemplatesForKnowledgeBase method in the ArticleTemplateUtilSNC script.

Within the ArticleTemplateUtil script, the code is as follows:

var ArticleTemplateUtil = Class.create();
        ArticleTemplateUtil.prototype = Object.extendsObject(ArticleTemplateUtilSNC,{
			
			// script override to disable Standard KB template
			getArticleTemplatesForKnowledgeBase: 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'] = 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'
        });

Hopefully this helps.

Regards,

Jay