A ServiceNow knowledge article template is a set of fields, placed in a fixed order, that an author picks when starting a knowledge article. Knowledge administrators create, activate and deactivate templates, and security administrators can limit who sees particular fields. The Standard template stays available by default and cannot be made inactive.
What the predefined templates contain
ServiceNow ships five predefined templates, each with a different article shape. Apart from Standard, each one keeps its fields in a table of its own.
| Template | Fields an author fills in | Storage table |
|---|---|---|
| Standard | Text | kb_knowledge |
| How To | Introduction, Instructions | kb_template_how_to |
| What Is | Introduction, Explanation | kb_template_what_is |
| FAQ | Question, Answer | kb_template_faq |
| KCS Article | Issue, Environment, Cause, Resolution | kb_template_kcs_article |
The structure of each template is recorded in kb_article_template, and its fields are recorded in kb_article_template_definition. All predefined templates ship inactive, so articles use the Standard template until one is switched on.
Turning on the template feature
The feature comes with the Knowledge Management Advanced plugin, com.snc.knowledge_advanced. It is installed through the installer plugin, com.snc.knowledge_advanced.installer, and the admin role is needed. Go to All, then System Applications, then All Available Applications, then All, find the plugin by name or ID, and select Install.
Before activation, the installer checks for active Knowledge Management v2 knowledge bases and for a unique database index on the Number field. A unique constraint on that field makes activation fail.
The same plugin also switches on article versioning, article subscriptions, the article quality index, ownership groups, in context article creation and translation management. Demo data is not loaded during activation; the Load Demo Data Only related link on the plugin page loads it.
Starting with the Xanadu release, the plugin activates automatically for new customers, but not alongside the Knowledge Management v3 application. With domain separation and delegated admin enabled, the administrative user must sit in the global domain.
Once the feature is on, go to Knowledge, then Administration, then Article Templates, and set the Active field to true on each template you want. Templates are linked to knowledge bases, and only active templates linked to a knowledge base are offered to authors.
Building a custom template
Go to All, then Knowledge, then Administration, then Article Templates, and click New. The name may contain only lowercase letters, digits and underscores, so network_outage_steps is valid and Network Outage Steps is not. Add a description. The Active check box is selected by default, which makes the template available for use. Right-click the form header and save.
The Article Templates Field related list then appears. Click New there, complete the Article Template Field form, and submit it. Repeat for each field. Article Template, Template Table and Template Field are read-only and filled in by the system.
| Setting | What it does |
|---|---|
| Field Name | Sets the title shown on the template form |
| Field Type | Sets the type: HTML, String, Integer, Date, or Date and time |
| Order | Sets the position in the article page view and the article edit view |
| Mandatory | When selected, the author must fill in the field |
| Expand/Collapse | Sets whether the field shows collapsed or expanded by default |
| Active | Sets whether the field displays on the template |
| Heading style | CSS applied to the template header, such as background colour, font size, font family and text colour |
| Field style | CSS applied to the fields. Field-level styling also reaches the header unless Heading style sets that property |
| Preview text | Text shown in the template selector. If left empty, the selector shows random text |
Each field adds a column to the template’s table. Creating a template creates a child table of kb_knowledge, and each field added to it becomes a column on that child table.
Arranging the fields on the author form
Adding fields does not decide the order an author sees. Go to Knowledge, then Articles, then Create New. Select a knowledge base and then the new template. Right-click the header, choose Configure, then Form Layout.
The layout screen has an Available column and a Selected column. Move each field to Selected, use the up or down icon to set the order, and click Save. An author who started a session before the template was created or activated sees it only after logging in again.
Setting the SEO description and preview text
On the Article Templates form, select a template, search for a field in the SEO Description Tag field, select it, and click Update. The content in that field is used as the meta description tags for articles created from the template. The number of characters used is set by the system property glide.knowman.seo.pages.meta_description.length.
A change of field affects only articles created or updated after the change. To apply it to existing published articles, run the Populate Meta Description on KB Articles fix script.
The Standard template’s preview text is set through a script include and needs the admin role. Under System Definition, open Script Includes, then open ArticleTemplateUtilSNC. Copy the function setPreviewTextForStandardArticle from its Script field. Open the ArticleTemplateUtil record and paste the function in so that the record extends ArticleTemplateUtilSNC. Replace null with the preview text and click Update. HTML tags are allowed in that text.
Restricting a field to particular roles
A template field, such as an internal cause note, may need to be hidden from some readers. Field encryption handles this. Knowledge blocks are a separate feature that restricts content inside one field.
The role needed is security_admin. Create an encryption module for the template field and associate the field with it. Then go to System Security, then Field Encryption, then Encryption Field Configurations, and click New. Choose the template table, for example How To [kb_template_how_to], and the template field in the Column field. Finally, go to User Administration, then Roles, open the role, and pick the encryption context in the Encrypted context field. That field may need adding to the Role form first.
Only String, Date, Date/Time and URL columns can be encrypted. String and URL fields work in a parent or child table. Date and Date/Time fields work in a parent table only, and encrypting existing values can take a few minutes.
The method matters. The single encryption module method uses one module, and users without it cannot view or update the value. The multiple encryption module method uses the encryption context of the first user to enter data. Mass encryption is not available with it. A single-module configuration can later move to multiple modules, but not back.
Choosing a template when creating an article
In Agent Workspace, go to All, then Agent Workspace, then Agent Workspace Home. Check Lists, then Knowledge, then All Articles for an existing article on the subject, then click New.
The author needs the agent_workspace_user role and contribute access to the knowledge base. For a template, the Create Article dialog asks for a Knowledge Base first. The Article Template list then shows the templates configured for that knowledge base. Select Create Article.
The dialog appears when article versioning and Knowledge Article Templates are enabled. The form fields then follow the chosen template. The Short description is the article title and holds up to 100 characters. A new article starts in the Draft workflow state.
Enabling duplicate checks for template articles
When an author creates an article from a template, the platform can search for possible duplicates. That search needs contextual search configured for the table behind the template. Go to All, then Contextual Search, then Table Configuration, click New, and use the admin role.
On that form, set the Search context field to Knowledge ML Search. Submitting the form adds Search Fields, Filter Configurations, Email Configurations and Search Action Configurations related lists, and Short description is added to Search Fields by default. Search results appear only for Search Fields that are visible on the form.
Upgrades, deleting and deactivating
Templates cannot be deleted, because each one has a child table and deleting the template would also mean deleting that table. Template columns are non-deletable too. Clearing the Active check box on the Article Template form turns off the Knowledge Article Templates feature.
When Knowledge Management is upgraded to Kingston or a later release, existing articles automatically use the Standard template of the upgraded version. For example, an upgrade from Jakarta to Kingston moves existing articles onto the Kingston Standard template.
Frequently asked questions
Why does my new template not show up for authors?
The template must be active and linked to a knowledge base. A template not linked to the author’s knowledge base will not appear in that base’s Article Template list. An author who was already signed in when the template was created or activated needs to log in again.
Can I delete a template nobody uses?
No. Each template has a child table, and templates cannot be deleted. Clearing the Active check box on the Article Template form turns off the Knowledge Article Templates feature.
Who can create, change and restrict templates?
Knowledge administrators, with the knowledge_admin role, create templates, change fields, and activate or deactivate them. Security administrators, with the security_admin role, configure field encryption and role permissions. The admin role is needed for the Standard template’s preview text and the contextual search setup.
Can I hide one field inside a template from some readers?
Yes, through field encryption. A security administrator creates an encryption module, links the template field to it, and grants the encryption context to the roles that should see the value.
Why does the duplicate check not run for my template?
Duplicate checking needs contextual search configured for the template’s table. Open the Table Configuration record for that table, set the Search context field to Knowledge ML Search, and save. The check can then run when an author creates an article from the template.