Incident Create Knowledge business rule - force an article template

jackinsidend
Giga Guru

We have the Incident Create Knowledge business rule active, and it works fairly well.

We are implmenting knowledge article templates, and I would like to tweak the business rule to apply a specific template to KB's created by that business rule. However there is no "template" field on the kb_knowledge table, the article template tables are essentially children of it.

Is there a way to do this?

Thanks,

Jack

1 ACCEPTED SOLUTION

jackinsidend
Giga Guru

Resolution 1. The Business Rule "Incident Create Knowledge" can be modified like below https://INSTANCE.service-now.com/nav_to.do?uri=sys_script.do?sys_id=245748ecc61122aa016c02dffbff7464

2. In the submitDirect() function, you can query for the kb article template table instead of kb_knowledge.

3. To apply template please use applyTemplate("TEMPLATE_NAME"); EG: kb.applyTemplate("kb_template_kcs_article");

4. Please find the documentation for the above method https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/form-administration/reference/r_ScriptedTemplates.html

View solution in original post

4 REPLIES 4

jackinsidend
Giga Guru

Also, this might be related. Does anyone know if you can apply a template to an article that was created without one?

Jack

jackinsidend
Giga Guru

Resolution 1. The Business Rule "Incident Create Knowledge" can be modified like below https://INSTANCE.service-now.com/nav_to.do?uri=sys_script.do?sys_id=245748ecc61122aa016c02dffbff7464

2. In the submitDirect() function, you can query for the kb article template table instead of kb_knowledge.

3. To apply template please use applyTemplate("TEMPLATE_NAME"); EG: kb.applyTemplate("kb_template_kcs_article");

4. Please find the documentation for the above method https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/form-administration/reference/r_ScriptedTemplates.html

Sarup Paul
ServiceNow Employee
ServiceNow Employee

You can also create/edit a new mapping to use a different template. Docs here

IndianaJones
Tera Expert

hi @jackinsidend ,

I was trying to figure this out and came up with this solution. Knowledge articles have a <sys_class_name> field that references the template name. If you set this field to the name of your template name, it should use that template when making the article. 

You can set it like this:

kb.sys_class_name = 'Template name here'; 

 

I recommend checking the XML of your article to see the exact name of that template being referenced.