Creating Change Request via Service Request

pradeepshokeen
Giga Contributor

Hello Everybody,

We would like to create a Change Request using a SR, is there a way to set change request fields using scripts. this is what I am doing.

1. Creating a Task in workflow item.

2. Setting up the fields using below scripts, there are fields that are created in Task form and fields create in change_request.

task.state = 7;

change_request.u_change_scale = "Minor";

change_request.risk = 4;

task.impact = 3;

task.contact_type = "change_service";

task.assignment_group = "2b931feb4faec200f6a144f18110c78e";

change_request.type = "Normal";

change_reuqest.start_date = current.variables.effective_date;

I am not able to create the Change Request using this approach, any assistance is highly appreciated.

Thanks,

Pradeep Shokeen

12 REPLIES 12

Can you explain me same, as i have the same requirement.



Thanks


Sukant


var newCR = new GlideRecord('change_request');


newCR.initialize();


newCR.state = 7;


newCR.short_description = "Switch Port Opening Request ";


newCR.description = "See request item " + current.number;


newCR.impact = 3;


newCR.u_change_scale = "Minor";


newCR.risk = 4;


newCR.assignment_group = "2b931feb4faec200f6a144f18110c78e";


newCR.type = "Standard";


newCR.contact_type = "change_service";


newCR.parent = current.sys_id;


newCR.cmdb_ci = current.variables.u_switch;


newCR.start_date = current.variables.port_execution_date;


newCR.requested_by = current.variables.requested_by;


newCR.setWorkflow(false);


newCR.insert();


Thanks Pradeep