How to create a Normal Change Template that will create Change tasks as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2018 01:23 PM
I need help. I am in Kingston. I thought I read the documentation correctly.
I createe the template for the change request and the Create New will pick up the template from the toggle template bar and create the normal change request. However, the process is not creating the change task under the change request from the child template I have tied. Maybe I am doing it wrong.
I have my main Change Request template with these keys:
Table:change_request, global, active, Link Element --None--, Next Related Child Template: Task_Template1
Next Related Template : blank
I have my Task_Template1 template with these keys:
Table: change_task , global, active, Link Element : Change Request (selected from drop down list),
Next Related child template : blank Next Related Template : blank.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2020 08:47 AM
Hello Guru,
Can you please share the screenshots where you created change tasks using the existing normal change request.
I already asked questions in the community but didn't found an appropriate answer.
below is the thread.
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2020 09:42 AM
Hi Guru - Would you mind advising on how you managed this please? I can create a template from an existing Normal change using the template bar but no tasks are ever produced?
Regards
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2020 08:42 AM
Hi All - Just in case it is of any use to you. I have found a way to create templates for 'Normal Change Requests' without amending our workflows and keeping everything tidy.
Background:- In our organisation we have a 'Standard Change' template catalogue, which is great for pre-approved changes that do not need to go through CAB, but what about Change Templates that could be used which carry pre-designed information and tasks and also go through the 'Normal Change' workflow?
After a long time head scratching, we found the answer and it was more simple than we thought
1. Create a new field on your Change Request form (We called ours Change Template):
In order for the user to be able to select from a list of normal changes, a new field is required on the Change Request form. Navigate to ‘Tables’ > Change Request and select New.
Choose ‘Change Request’ in the Table field.
Choose ‘Reference’ in the Type field.
Type ‘Change Template’ in the Column label field
Under the ‘Reference Specification’ tab you will need to build out your reference qualifier in order for ServiceNow to provide you with the correct templates once done.
Choose Template in the Reference field
Then build out your reference qualifier
Table is Change_Request
and
User is(dynamic) Me
or
Group is(dynamic) One of My Groups
or
Global is True
and
Active is True
and
Class is Template
Once done, update it and add your required ACLs then proceed to place it where you want on your Change Request form.
2. Create a Business Rule
In order for this field to work in the way that you want, a Business Rule is required. On a Change Request record select the context menu then ‘Configure’ > ‘Business Rules’.
Select ‘New’ and start building your Business Rule
Ensure that you work off of the Change_Request table and that 'Active' and 'Advanced' are ticked.
Under 'When to run'
When = after
Insert = true
Update = true
Filter conditions are:
Change Template = Changes
and
Change Template = is not empty
In the 'Advanced' tab, enter the code below:
In the ‘Advanced’ tab enter copy and paste the code below into the ‘script’ field:
(function executeRule(current, previous /*null when async*/) {
//current.applyTemplate(current.u_change_template.getDisplayValue());
var temp = current.u_change_template.getRefRecord();
if (temp.next_child){
var childTemp = temp.next_child.getRefRecord();
applyNextChild(childTemp);
}
function applyNextChild(temp){
var childTask = new GlideRecord(temp.table);
childTask.initialize();
childTask[temp.link_element] = current.sys_id;
childTask.applyTemplate(temp.name);
childTask.insert();
if (JSUtil.notNil(temp.next))
applyNextChild(temp.next.getRefRecord());
}
})(current, previous);
3. Create a Client Script
In order for the Change Template to act the way you want it to, a Client Script is required. On a Change Request record select the context menu then ‘Configure’ > ‘Client Scripts’.
Select ‘New’ and start building your Client Script.
Table = Change_Request
UI Type = Desktop
Type = onChange
Field name = Change Template
Active = True
Inherited = True
Global = True
Then paste the script below into the 'Script field'
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
applyTemplate(g_form.getValue('u_change_template'));
}
4. Finally Building your templates
This is too big to document on here so I have pasted the official release notes
If you have done all of this correctly then it should work for you.
Thanks