- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 03:25 AM
Hi guys!
We added a few new change types using this guideline: Add a new change type
This works just fine until we want to create a change from an incident.
I would like to make a new UI action for each new change type (so it can be used/clicked from the "form context menu") using the (OOB) script from "Create Normal Change" - lets call this new change-type : Infrastructure_server. The only difference between Normal-change and Infrastructure_server-change is the workflow behind. So same fields on the change-form etc.
(function(current, previous, gs, action) {
var changeRequest = ChangeRequest.newNormal();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.insert();
current.rfc = changeRequest.getGlideRecord().getUniqueValue();
current.update();
gs.addInfoMessage("Change " + changeRequest.getValue("number") + " created");
action.setRedirectURL(changeRequest.getGlideRecord());
action.setReturnURL(current);
})(current, previous, gs, action);
---
The problem is this line...where ServiceNow (Helsinki) create a new object using "newNormal()".
var changeRequest = ChangeRequest.newNormal();
I want to make something like this..:
var changeRequest = ChangeRequest.newInfrastructure_server();
When I look into the "script includes" the script "ChangeRequestSNC" is the only place where "newNormal()" is defined by this lines (302-304):
ChangeRequestSNC.newNormal = function() {
return ChangeRequestSNC.newChange(ChangeRequest.NORMAL);
};
...but this script include is read-only...
So how could I add a new change-type to the "create change functionality from incidents" ?
Thanks!
Soeren
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 04:17 AM
Hi,
Did you go through the link Add a new change type that explains how to add your own Change Type. You need to ensure that you create a Workflow and specify the condition in the Workflow appropriately so that it gets attached to the Change_Request records when type = INFRASTRUCTURE_SERVER.
Refer to step 6 "Create a workflow for the new change request type." in the link Add a new change type.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 06:21 AM
Hi I would implement the same customization but i see that the script include "ChangeRequest" is protected and read only ! What should I do to modify it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 07:35 AM
I mean a can create a new one and get the integration work but I could not modify the original Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 08:04 PM
Luca, this has been fixed in HP3 and GP9. The script include ChangeRequest has been opened for editing.
Which release and patch level are you in?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 06:01 AM
I was testing this on a quite old instance: MID buildstamp: geneva-08-25-2015__patch8-hotfix1-09-28-2016_09-28-2016_1638
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 02:26 AM
Hi Soren priisholm,
I see you managed to get it working - can you tell me how you scripted the UI Action please?
On the OOTB UI action 'Create Emergency Change', and 'Create Normal Change, the 2nd line creates the different type of change but I am not sure what to use for a change type which has been custom made. Do I need to modify the Script Include 'ChangeRequest'?
I have followed the documentation Add a new change type to create a new change type 'Expedited Change', and i have created the necessary workflows.
Any help is much appreciated
Thanks in Advance,
Robert