- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 02:54 PM
Hi,
I have a question revolving around incident form templates, and the ability to add additional filtering to the templates in order to only show particular templates in the template list, depending on what the ticket Category, subcategory, and/or short_description fields are.
To provide a bit of info about our setup, we are utilizing ServiceNow in the manner that our tickets are auto-created by a back-end monitoring system. Out tickets are NOT created by support engineers. So a lot of the fields are already auto-populated. We will just be leveraging templates primarily to populate the Work notes, Resolution notes, Incident state, and resolution code;...things like that.
So, currently, if an engineer is to open up the template bar, there will be a big list of templates. I would like to be able to filter this list down a bit more so the engineer does not have to look through so many templates.
If I go to the System Definition > Templates, and click New to create a New template, I do have the option to apply that template to a particular User and/or Group. After checking out the definition of these fields, they appear to be reference fields.
So my question is, can I create a reference field for, let's say "Subcategory", or even "Short description"? The idea behind this, is that a ticket with a particular short description, would only show templates that apply to that short description reference field.
Before digging in to this too much further, I wanted to check and see if this was possible. Because I did notice a bunch of 'script includes' that appear to control what is populated in the template bar template list. So if I add a reference field, I suspect I will need to tweak these script includes as well.
Thanks,
Chris A.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2019 06:21 AM
Hi Chris,
This is an interesting use case. Please see my idea for it.
1. I have created 5 templates, 3 for SAP issues and 2 for ServiceNow issues. They are grouped by Short description that is the same for similar case(this is the template's short description, not the one that is part of the template).
2. I have created a Reference Filed on Incident with a name "Choose template", it points to sys_template table and I have set the Reference Qual to advanced as: javascript: "short_descriptionLIKE" + current.short_description
3. And the last part, I have created an OnChange Client Script set on the Choose template field with a script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
applyTemplate(newValue); // apply the new template that has been chosen
}
The result looks like this for Problem with SAP:
And for Problem with ServiceNow:
After a template will be chosen, it will populate the fields.
The only thing to remember is that the Short description of an Incident should be a constant if a short description will be changed the proper templates will not be found.
Hope this helped or triggered some ideas 🙂
Best regards,
Łukasz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 06:26 AM
After working with Servicenow, we discovered that an enhancement request was required to achieve the desired outcome within the template bar. Enhancement request has been submitted.
We will be using your proposed solution Lukasz. Thanks again!
-Chris