Insert a record when you click on New button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 05:37 AM
I have a scenario that I want to insert a record in Incident table when click on the 'New' Button of the Incident list or 'Create New' of incident.
The incident can have only incident number the record must insert as soon as I click and I should not need to save or submit on the incident form.
Please help.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 06:02 AM
Hi Parag,
Simply try the below script in your UI action
var gr= new GlideRecord('incident');
gr.initialize();
gr.insert();
gs.print(gr.number);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 07:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 06:06 AM
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.assignment_group = current.assignment_group;
newinc.assigned_to = current.assigned_to;
newinc.description = current.description;
newinc.short_description = current.short_description;
newinc.impact = current.impact;
newinc.category = current.category;
newinc.state = current.state;
newinc.severity = current.severity;
newinc.priority = current.priority;
newinc.insert();
gs.addInfoMessage('Incident ' + newinc.number + ' created.');
action.setRedirectURL(newinc);
action.setReturnURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2017 12:36 AM
HI
may i know the status of ur thread in case if it is resolve then close the thread