- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2024 11:39 PM
How to create Expedite Change from Incident.Expedite change is like Normal change.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 01:08 AM
It looks like you are setting your Change Request as a normal one (var changeRequest = ChangeRequest.newNormal()). Your setting of the type value isn't over writing that. Put this in as your script (make sure you also have a Change Model for Expedite):
var changeRequest = new GlideRecord('change_request');
changeRequest.initialize();
changeRequest.setValue("type", 'expedite'); // or the value you have given it
changeRequest.setValue("chg_model", 'sys_id_of_expedite_change_model');
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);
var sysId = changeRequest.insert();
current.rfc = sysId;
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 12:38 AM
Can you share your code? Is the 'expedited' a choice on the change type field, so it can be set and did you set it in your code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 12:40 AM - edited ‎05-28-2024 12:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 01:08 AM
It looks like you are setting your Change Request as a normal one (var changeRequest = ChangeRequest.newNormal()). Your setting of the type value isn't over writing that. Put this in as your script (make sure you also have a Change Model for Expedite):
var changeRequest = new GlideRecord('change_request');
changeRequest.initialize();
changeRequest.setValue("type", 'expedite'); // or the value you have given it
changeRequest.setValue("chg_model", 'sys_id_of_expedite_change_model');
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);
var sysId = changeRequest.insert();
current.rfc = sysId;
current.update();