Adding New Change Type

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2019 11:26 AM
I followed this document to add a new change type. However it does not go over how to update the ChangeRequest script include so you can create a change request of this new type thought a UI Action. How do I go updating the script include?
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2019 01:50 PM
what does your UI action look like?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2019 06:40 PM
(function(current, previous, gs, action) {
var changeRequest = ChangeRequest.newExpedite();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
if (changeRequest.hasValidChoice('priority', current.priority))
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.setValue("u_parent_ticket", current.sys_id);
changeRequest.insert();
current.u_rfc = changeRequest.getGlideRecord().getUniqueValue();
current.update();
var incUrl = "<a href='" + current.getLink(true) + "'>" + current.getDisplayValue() + "</a>";
gs.addInfoMessage(gs.getMessage("Expedite Change {0} created from {1}", [changeRequest.getValue("number"), incUrl]));
action.setRedirectURL(changeRequest.getGlideRecord());
action.setReturnURL(current);
})(current, previous, gs, action);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2019 06:06 AM
I looked at my UI actions and they have a few extra lines at the top. They look like this:
(function(current, previous, gs, action) {
var target = {};
target.table = current.getTableName();
target.sysid = current.getUniqueValue();
target.field = 'rfc';
try {
target.isWorkspace = (typeof RP == 'undefined');
}
catch (err) {
target.isWorkspace = false;
}
gs.getSession().putProperty('change_link', target);
var changeRequest = ChangeRequest.newNormal();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
if (changeRequest.hasValidChoice('priority', current.priority))
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.insert();
action.setReturnURL(current);
action.setRedirectURL(changeRequest.getGlideRecord());
})(current, previous, gs, action);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2019 07:09 AM
Thanks for all your help. I have another Post out there if you have any thought on that one.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2019 07:17 AM
Sorry this created a Normal change