- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 04:25 AM
I want to create a UI action button to create a new child incident with the current incident as a parent.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 04:38 AM
Hi varshini,
To make the current incident Parent incident firstly we create an incident form object. Initialize it and assign the sys_id to the current object. (make the UI action Server Side)
use insert() to insert it into the table or else you need to make some additional changes and click on submit button.
var gr = new glideForm('incident');
gr.initialize();
gr.parent_incident = current.sys_id;
// This will redirect to the child incident form
action.setRedirectURL(gr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 04:28 AM
Hi,
should be simple enough
UI action will be server side
Something like this and you can enhance it further
// Create new incident record
var incident = new GlideRecord('incident');
incident.parent_incident = current.sys_id;
incident.cmdb_ci = current.cmdb_ci;
incident.category = current.category;
incident.subcategory = current.subcategory;
incident.caller_id = current.caller_id;
incident.insert();
gs.addInfoMessage("Child incident " + incident.number + " has been created");
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 10:16 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 04:29 AM
Hi there should be afield called as "parent_incident" you can use that for example in your UI Action
gr.parent_incident= current.sys_id ; // set it to parent field
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 04:38 AM
Hi varshini,
To make the current incident Parent incident firstly we create an incident form object. Initialize it and assign the sys_id to the current object. (make the UI action Server Side)
use insert() to insert it into the table or else you need to make some additional changes and click on submit button.
var gr = new glideForm('incident');
gr.initialize();
gr.parent_incident = current.sys_id;
// This will redirect to the child incident form
action.setRedirectURL(gr);