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

Hi Dimitar, is there any way to set the new change view to a particular view? As I want this clone change feature only for changes in a particular view and they should also redirect to the same view and not the default view as this would mean a lot of fields would be invisible even though it has been copied.



Your thoughts please


Hello Mark,


My first thought would be to ask if the record used to clone another was in a closed state,   This would fall under a UI policy that may be in place to make fields read-only when the state is closed.   Are the other fields custom fields or OOB?  



A UI policy could also be in place to make the description field read-only if the request state is set to approved... so that changes cannot be made to the description of the request after it was approved.  



Thanks,
David


I'm working on cloning an Incident but the only part that's is preventing me from releasing is that I can't figure out how to have initialized record remain open and unsubmitted so small adjustments can be made before its submitted and inserted into the database.


Hi Paul


In this case I would ensure that active is not copied (or set to true) and that the state field is set to 1 for new.


I'm not copying the Active attribute (at least that I know of) and regardless of what value I set state to (1=New, 2=Active), I can't get the newly populated Incident form to appear unless its inserted.   As you can see in my script, I have the insert command on line 12, but without that line, the new form doesn't appear at all.   In the form I'm showing here, I also realize the action statements would only return a URL only if the record is actually inserted.



var newinc = new GlideRecord('incident');



newinc.initialize();


newinc.short_description = current.short_description;


newinc.assignment_group.setDisplayValue("Operators");


newinc.u_incident_type = "Network";


newinc.u_incident_subtype = "Problem Report";


newinc.category = "Network Connectivity";


newinc.u_reporting_method = "Email";


newinc.state.setValue(1);



newinc.insert();



gs.addInfoMessage('Incident created as clone.   Make your adjustments and Submit');


//gs.addInfoMessage('Incident ' + newinc.number + ' created as clone.');


action.setRedirectURL(newinc);


action.setReturnURL(current);



Ive been working on a UI Action to invoke a Record Producer, but not having much luck there either.