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

Ok, issue at least isolated.



Where did you enter this script? Is it a 'Run script' activity in the workflow? Question is what is your current object. As you used current.number for the description, what was mentioned in there? Is it the catalog task or the requested item?


Yes I am running this Script in the Run Script Workflow Editor. My Objective is to create a Change Request from the Requested Item from where I am capturing Configuration Item, Affected Start Date of the change request.


Once this is captured and approved a CR will be inserted with Configuration Item and Affected Start Date to a specific team and once we reach the affected date it will send an email to my automation team which in turn would perform the required changes on the configuration Item.



Current.number provides the number of the Requested Item RITM number.







Thanks and Regards,


Pradeep Shokeen


That's strange then, current.variables should work just fine there. Can you check if you have the variable names correctly? You could try a loop on all variable just to be sure they are there.


sukant
Kilo Contributor

Hi Pradeep,



are you able to creating change request via service request ?



I am having the same req.



Can you tell me how to achieve this req ??



Thanks


Sukant


Yes I was able to create the CR from Service Request. use Script in workflow editor to create a record in Change Request Table.



Thanks,


Pradeep