- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 11:49 AM
Starting with Geneva, the OOTB Change Management Application has been significantly improved with many things. One of the most confusing parts of it for me are the script includes.
To meet the needs of a client, I've had to modify the standard change to have a Change Manager approval in the workflow. I have already copied the OOTB workflow for standard changes, and modified it to include the approval. The issue I am having is knowing which script includes to modify, and how to do it.
Also, I don't understand what the script between the "Class.create()" and "prototype" lines is doing. A few of the change request script includes have it. (for example: ChangeRequest from lines 3-6.)
var ChangeRequest = Class.create();
ChangeRequest.NORMAL = "normal";
ChangeRequest.STANDARD = "standard";
ChangeRequest.EMERGENCY = "emergency";
ChangeRequest.CHANGE_REQUEST = "change_request";
ChangeRequest.prototype = {
I was able to modify the "ChangeRequestStateModel_standard" script include, to make the "authorize" state the "nextState" available after draft. However, it doesn't affect the system to show the appropriate UI action for the Draft State while in standard changes, or the action taken with the UI action.
Any feedback to help me better understand the system of script includes with Change Requests would be awesome.
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 11:53 AM
Hi Simon,
the first few lines of code are just declarative statements to set some constants available to the rest of the script include. Putting these up front makes it easier to change. They correspond to the type field of the change request.
As for the rest, these may help:
Geneva: Three "c"hanges with a Big Impact on Change Management
Geneva: Change Management - Making Change a Little Less Painful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 11:53 AM
Hi Simon,
the first few lines of code are just declarative statements to set some constants available to the rest of the script include. Putting these up front makes it easier to change. They correspond to the type field of the change request.
As for the rest, these may help:
Geneva: Three "c"hanges with a Big Impact on Change Management
Geneva: Change Management - Making Change a Little Less Painful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 06:24 AM
Thanks Chuck!
Very helpful as always

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 06:27 AM
You are very welcome. Thank you for the kind words. Thank you for participating in the community.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 11:57 AM
Hey Chuck (Or anyone whom can answer )
The script include of "ChangeRequest" puzzles me a little, maybe im missing something (Highly likely).
It has alot of hardcoded states such as:
setClose: function(closeCode, closeNotes) {
switch (closeCode) {
case "unsuccessful":
this._gr.state = 4;
break;
case "successful":
this._gr.state = 3;
break;
default:
this._gr.state = 3;
if (closeNotes)
this._gr.close_notes = closeNotes;
}
},
So if this runs, without a close code (as it does via some of the business rules - such as business rule: "SNC - ITIL - Close Related" from Geneva below
chgReq.close(); - as below.
function closeChange(myID, fromNumber) {
var rfc = new GlideRecord('change_request');
if (rfc.get('sys_id', myID)) {
var chgReq = ChangeRequest(rfc);
if (!chgReq.isClosed() && !chgReq.isCancelled()) {
chgReq.close();
var msg = "Change " + rfc.number + ' closed based on closure of task '+ fromNumber;
var notes = rfc.close_notes.getDisplayValue();
notes = notes + '\n' + msg;
rfc.close_notes = notes;
rfc.update();
}
}
}
If the customers system has custom states for change (such as mine) where Closed != 3
It could cause chaos?
I guess the answer is "Dont use it" but in other code, ServiceNow usually read from the dictionary for values such as "close_states=3,4,5" and use that. I wondered why they didnt apply that here? I suppose that will be my solution until future updates.
Thanks,
Chris