Create change from problem, but do not insert

Annirnita Dash1
Tera Contributor

Please help me out in creating a change request from problem but not inserting it. Since the Ui action which creates a change record is saved through it that runs, the mandatory fields not filled in and  continue to show as required. It should navigate to sys_is -1.

 

Below is the code and I have commented out line where it inserts.

 

var change = new GlideRecord("change_request");
change.short_description = current.short_description;
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
change.company = current.company;
change.sys_domain = current.sys_domain;
change.type = 'Normal';
//var sysID = change.insert();
 
current.rfc = sysID;
var mySysID = current.update();

gs.addInfoMessage("Change " + change.number + " created");
action.setRedirectURL(change);
action.setReturnURL(current);