Create Expedite change from Incident

Hareesha
Tera Contributor

How to create Expedite Change from Incident.Expedite change is like Normal change.

1 ACCEPTED SOLUTION

Mark Manders
Mega Patron

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();

Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

7 REPLIES 7

Mark Manders
Mega Patron

You will need to give more information. Does this has to be done automatically, or through a UI action? If it's a UI action, check on the OOB UI action for 'create change' on the incident table. For automation, I would create a flow that triggers on your conditions and creates the change, including all the fields you want to copy from the incident.
If it's something else: please elaborate on your requirement.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

requirement is to create from UI Action. 

Mark Manders
Mega Patron

The system has a lot of examples: 
https://[your_instance].service-now.com/sys_ui_action_list.do?sysparm_query=nameLIKEchange%5EnameSTARTSWITHCreate&sysparm_view=

 

Even 4 on the incident table:
https://[your_instance].service-now.com/sys_ui_action_list.do?sysparm_query=nameLIKEchange%5EnameSTARTSWITHCreate%5Etable%3Dincident&sysparm_view=


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

My issue is i have Type field on Change form, when i create a new UI action similar to Normal Change.Type field on change form is getting updated to Normal,not Expedited.