- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2018 09:29 AM
I have created a before insert / update business rule to copy fields from a parent incident to a new child incident, but the fields are not populating. My code is below:
(function executeRule(current, previous /*null when async*/) {
//Get parent incident
var gr = new GlideRecord("incident");
gr.addQuery("parent_incident", current.sys_id());
gr.query();
gs.addInfoMessage("parent incident = " + current.sys_id); //for testing
// Setting values to match parent
gr.setValue("cmdb_ci", current.cmdb_ci);
gr.setValue("category", current.category);
gr.setValue("subcategory", current.subcategory);
gr.setValue("assignment_group", current.assignment_group);
gr.setValue("impact", '3');
gr.setValue("urgency", '3');
gs.addInfoMessage("cmdb ci = " + cmdb_ci);
gs.addInfoMessage("current cmdb ci = " + current.cmdb_ci);
gr.update();
})(current, previous);
Any help is greatly appreciated! Thanks!
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2018 09:32 AM
first, I would make it an after BR instead of before br. and make a few changes to your script. You won't see this part from the script, but you had a () after current.sys_id, which you don't need, and then a couple of other changes there as well.
(function executeRule(current, previous /*null when async*/) {
//Get parent incident
var gr = new GlideRecord("incident");
gr.addQuery("parent_incident", current.sys_id);
gr.query();
gs.addInfoMessage("parent incident = " + current.sys_id); //for testing
while (gr.next()) {
// Setting values to match parent
gr.setValue("cmdb_ci", current.cmdb_ci);
gr.setValue("category", current.category);
gr.setValue("subcategory", current.subcategory);
gr.setValue("assignment_group", current.assignment_group);
gr.setValue("impact", '3');
gr.setValue("urgency", '3');
gs.addInfoMessage("cmdb ci = " + cmdb_ci);
gs.addInfoMessage("current cmdb ci = " + current.cmdb_ci);
gr.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2018 09:32 AM
first, I would make it an after BR instead of before br. and make a few changes to your script. You won't see this part from the script, but you had a () after current.sys_id, which you don't need, and then a couple of other changes there as well.
(function executeRule(current, previous /*null when async*/) {
//Get parent incident
var gr = new GlideRecord("incident");
gr.addQuery("parent_incident", current.sys_id);
gr.query();
gs.addInfoMessage("parent incident = " + current.sys_id); //for testing
while (gr.next()) {
// Setting values to match parent
gr.setValue("cmdb_ci", current.cmdb_ci);
gr.setValue("category", current.category);
gr.setValue("subcategory", current.subcategory);
gr.setValue("assignment_group", current.assignment_group);
gr.setValue("impact", '3');
gr.setValue("urgency", '3');
gs.addInfoMessage("cmdb ci = " + cmdb_ci);
gs.addInfoMessage("current cmdb ci = " + current.cmdb_ci);
gr.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2020 12:08 PM
Hi John,
Hoping you might have some suggestions.
We are experiencing the same issues where an Affected CIs / Impacted Service / cmdb_ci updates are not showing in the child record.
I tried creating a Business Rule so that when we manually update the Parent incident, it also appears in the Child Incident.
We have also activated the Parent Incident field in the related records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2021 04:13 PM
Hi John,
When I'm changing the incident state to "On-Hold", the reason provided is being copied to child incidents from parent incident, but when I select reason as "Pending Vendor", it does not copy the fields(Vendor and Vendor Ticket Open Date) as colored yellow in color. What should I add in Business Rule?
Thank you
Best,
Pranav Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2018 09:40 AM
That's it, thanks!