- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 05:58 AM
How to get all child incidents number associated with particular Parent incident using server side Script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 06:02 AM
Run below script in background script, it will print all child incidents.
var inc = new GlideRecord('incident');
inc.addQuery('parent', ' '); // pass the sys_id of parent incident
inc.query();
while(inc.next())
{
gs.print(inc.number); // it will print all child incident numbers
}
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 06:02 AM
Run below script in background script, it will print all child incidents.
var inc = new GlideRecord('incident');
inc.addQuery('parent', ' '); // pass the sys_id of parent incident
inc.query();
while(inc.next())
{
gs.print(inc.number); // it will print all child incident numbers
}
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 09:17 PM
Only Small change is there:
Replace parent with parent_incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2023 07:48 AM
How write a background script in servicenow to get the parent and child incident records for the entire incident table in database and not just for one parent incident record