- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2015 06:36 PM
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);
2nd shot below is picture of form with button on it
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2015 10:10 PM
For your reference, this works.. Attaching the xml of the ui action and a screenshot for your reference

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2015 07:47 PM
Why don't you make a copy of 'Insert & Stay" UI Action and call it Copy Incident, make it a button.
Then add your 2 lines of code 'current.caller_id = ''; current.impacted_user = ''; (not sure the correct field name but you get the idea) before the current.insert();
done

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2015 08:50 PM
Hi Terry Reese
You could refer the below post as a reference.
https://community.servicenow.com/message/670531#670531
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 11:11 AM
On clicking copy incident button some of the fields which I script should be copied to the child's incident with new incident number and then i should be able to submit it after filling some of the other fields. because of newinc.insert() function. New form is created before I submit with only some values filled in.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2015 10:04 PM
Remove the statement fron 'onclick' field of the UI action .. Dont make the ui action a client side button(Un check the client checkbox).. Paste the code in script now and check...