- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎09-16-2020 08:46 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
- 13,034 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello,
Is there a way to make the Assignment Group static/unchangeable in the Normal Change Template so that regardless which CI or Application Servie is chosen, the Assignment Group remains to what it was specified in the template...
TIA
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Unless you specify it when creating the Change Template itself I don't believe it is possible. I have tried it without success.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I specify it in the CHANGE TEMPLATE (which consists of additional Approvers, Short Description and Description Text as well as the Assignment Group. But when users fill in the CI and the application service involved/impacted (along with its SO and S), the Assignment Group is overwritten by the associated Change Group of the CI or Application Service... User need to fill in the Assignment Group to what it was before...
Thanks for your reply though.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
Where usually are the change requests housed? Is it appropriate to have them in the service catalogue?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Dhanalngle - Maybe you mean where the change templates are housed? I am not an expert but here is what I have learned from within our configuration. (Note I have found not everyone is setup the same for some areas I have researched)
You can find Standard Change Templates tracked in sc_cat_item, they have a class of Standard Change Template
Users use Standard CHG templates when they change - create new - standard. This takes them into the catalog that shows the templates to choose from.
You can find Normal Change Templates tracked in sys_template with table of change_request and class of Template
Users use Normal CHG templates when they create a change-new-normal. Toggle template taskbar to on. Then select a Normal template (one that was set as Global, or that is not global but the user created).
Users with the correct access can use the template manager to create a normal template - for us it would be the menu item Manage Change Templates. They have to set the template as global if they want other users to use that template.
Hope that if of value to at least get you pointed to the right areas of your install!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Can anyone confirm if Modern Change Management, based on the Change Model, supports automatically applying templates to 'Normal' or 'emergency' change requests?