Copy an incident

reeset
Kilo Contributor

Hi, I am trying to create a "copy incident" button that will copy all the completed fields except caller and impacted user to a new incident.   This will be used when we have multiple copies of the same request for different people.   I was able to get te button to display but when I click on it, it doesn't do anything.   Here is my code, any help woul be greatly appreciated.

var newinc = new GlideRecord('incident');

newinc.initialize();
newinc.short_description = current.short_description;
newinc.u_requested_by = current.u_requested_by;
newinc.u_requested_for = current.u_requested_for;
newinc.assignment_group = current.assignment_group;
newinc.assigned_to = current.assigned_to;
newinc.description = current.description;
newinc.u_business_impact = current.u_business_impact;
newinc.category = current.category;
newinc.u_service_affected = current.u_service_affected;
newinc.u_service_impact = current.u_service_impact;
//newinc.incident_state = current.incident_state;
newinc.severity = current.severity;
newinc.impact = current.impact;
newinc.priority = current.priority;


newinc.insert();

gs.addInfoMessage('Incident ' + newinc.number + ' created.');
action.setRedirectURL(newinc);
action.setReturnURL(current);

find_real_file.png

2nd shot below is picture of form with button on it

find_real_file.png

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

For your reference, this works.. Attaching the xml of the ui action and a screenshot for your reference


View solution in original post

8 REPLIES 8

Kalaiarasan Pus
Giga Sage

For your reference, this works.. Attaching the xml of the ui action and a screenshot for your reference


Thank you for your assistance.   I think I was making a very stupid mistake`   Although I put the code in the UI action.   I never saved the code.   As soon as I hit save and then update it started working.



Thank you all for your assistance, if you didn't reply I wouldn't have rechecked it and found out what was causing the error.


Hello,



Will this work on Geneva? I tried the above script and I didn't get a copy button.



Please advise.



Thank you.


natti
Kilo Contributor

to this script all the fields in incident are coping. but i want only some fields like caller id, location, short description, mobile number, email id   only. what will i do.by removing the extra fields in script i didnt got the output