Create Multiple Child Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 10:51 PM
Hello All,
I have a requirement to make an Incident as parent Incident automatically while creating it and to define multiple child Incidents(say more than 15) with different assignment group and caller automatically with same remaining field values. All these should happen when a user checks a check box "Special Security Incident" on Incident form.
I have tried writing a after insert BR which will run on checking the special security incident check box on incident form.
for initial testing I have written code for 3 child incidents, but still no child incidents were created.
CODE:
(function executeRule(current, previous /*null when async*/ ) {
//var parent_inc = current.getUniqueValue();
var currentsysID = current.getUniqueValue();
gs.log("check parent incident:" + currentsysID.toString());
for (var i = 0; i < 3; i++) {
if (i == 0) {
var gr = new GlideRecord("incident");
gr.initialize();
gr.parent_incident = currentsysID;
gr.category = current.category;
gr.subcategory = current.subcategory;
gr.caller_id = '0e4070a74f2ba2006ff669d18110c776';
gr.state = current.state;
gr.assignment_group = '2207520387850d10f4b562083cbb354a';
gr.short_description = current.short_description;
gr.description = current.description;
gr.priority = current.priority;
gr.impact = current.impact;
gr.urgency = current.urgency;
gr.state = current.state;
gr.insert();
gs.log("first child incident is successfully created--------------------->");
}
else if (i == 1) {
var gr1 = new GlideRecord("incident");
gr1.initialize();
gr1.parent_incident = currentsysID;
gr1.category = current.category;
gr1.subcategory = current.subcategory;
gr1.caller_id = '4b6934201b168d10f300edb1b24bcbf8';
gr1.assignment_group = '591221f01bd20d109570a71ee54bcb58';
gr1.state = current.state;
gr1.short_description = current.short_description;
gr1.description = current.description;
gr1.priority = current.priority;
gr1.impact = current.impact;
gr1.urgency = current.urgency;
gr1.state = current.state;
gr1.insert();
gs.log("second child incident is successfully created--------------------->");
}
else if (i == 2) {
var gr2 = new GlideRecord("incident");
gr2.initialize();
gr2.parent_incident = currentsysID;
gr2.category = current.category;
gr2.subcategory = current.subcategory;
gr2.caller_id = '2e47fda6dbd12bc8de62384c7c961919';
gr2.assignment_group = 'e3f73f061be189109570a71ee54bcb5f';
gr2.state = current.state;
gr2.short_description = current.short_description;
gr2.description = current.description;
gr2.priority = current.priority;
gr2.impact = current.impact;
gr2.urgency = current.urgency;
gr2.state = current.state;
gr2.insert();
gs.log("third child incident is successfully created--------------------->");
}
}
})(current, previous);
Can anyone please guide where it is going wrong.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 11:02 PM
Isn't it easier to use Major Incident Management for this?
If my answer helped you in any way, please then mark it as helpful.
Mark
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 11:33 PM
a. Please troubleshoot in small steps
b. Remove the "for" loop and retain only the first snippet (i.e. create 1 child incident)
c. Turn on Debug Business Rule and check if the BR is executed or skipped when the parent incident is created
d. Please also add a screenshot of the "When to Run" page of the BR here. I hope there are no additional conditions added on top of "special security incident check box"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 11:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 11:12 PM