Can you clone/copy a change request?

jmbrake
Kilo Expert

Is there a way to take a past change request either approved, cancelled or in waiting approval state and copy it.   From there change the dates and submit it as new?

1 ACCEPTED SOLUTION

Hi Joan,



It is actually really easy. What you need to do is create a new UI Action(you define the type - button, cotext menu, etc.), as:


1. select the table: change_request


2. set the UI Action as Active and select when to show - on insert, update, etc.


3. have the script which creates a new record and carries over all attributes/fields that you wish (please see it attached)


And that should be it.



I hope this would help you. If so, please mark it up.


Good luck in creating!


View solution in original post

33 REPLIES 33

Chris M3
Tera Guru

Should just be about building a UI Action that initializes a new record, copies over the fields you want copied, and insertting it into the table.   Nothing tricky, you just need to decide what fields to copy, and what to set certain fields (such as the approval status).


jmbrake
Kilo Expert

You make it sound easy.   I am in day 6 with my company and only have a 2 day System Admin class under my belt.   Can you provide a more detailed (step by step) procedure?


Goto your change request table, right click in the heading to access Personalize - UI Actions.


Click New.   Name it appropriately, and determine where you want it (Form Button, Form Link, or Form Menu).



Then in the script, something like the below, expand as needed for additional fields.



var newChange = new GlideRecord('change_request');


newChange.initialize();


newChange.assignment_group = current.assignment_group;


newChange.short_description = current.short_description;


newChange.state = 1; // Or some other appropriate value


// Add additional fields you want to copy or set here.


newChange.insert();


gs.addInfoMessage(current.number + ' Change Request copied to ' + newChange.number);


Thank you, this was most helpful.