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-07-2017 12:39 AM
Hi Kuruva,
The issue is still does not have answer yet, so I would keep this question running.
Thanks
Parag

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2017 12:48 AM
The UI Action 'New' in question has the sys_id 80c8c3a60a0a0b34003364513f7d9d27 in my system.
- Name: New
- Table: Global
- List banner button: true
If you want to override it, change the 'Table' field to 'Incident' and click 'Insert and Stay'.
If you want a new button, change the name and action name to something unique.
Then replace the code with the following code as provided by vinothkumar
var gr= new GlideRecord('incident');
gr.initialize();
gr.insert();
gs.print(gr.number);
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2017 12:56 AM
I'm not certain that's possible, since the Incident form contains mandatory fields which must be completed prior to the record being inserted.
It sounds like you want a button that inserts a new record without having to fill anything in. I'm puzzled behind the reasons for this, since it means you'll potentially end up filling the table with plenty of records containing a Incident number and nothing else.
Why have "empty" records in your incident table? I don't see how this benefits incident resolution at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2017 01:33 AM
Actually in my case I want to show some popup and some fields on that popup. This popup gets called on onLoad() that means as soon as I click on new button it loads GlidDialogueForm and shows the fields .. Now the issue is record is not yet inserted in database because of that no values gets saved...I am not sure how I can submit values from popup and from the default view incident form in the background to save both of them on submit button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2017 02:24 AM
So the benefit is wanting to show form fields on a popup... for a record not yet created? It feels a bit like reinventing the wheel here.
How does this benefit those doing incident resolution? It sounds like you ought to be doing your popup on existing records, rather than creating a new record just for the sake of populating a popup.