Once Parent Incident Status Changes, Child Ticket Status Should Change automatically for all the states
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 03:06 AM
Hello All,
We are getting a conflict in our current scenario as whenever the Parent Incident Status changes to OnHold and On-hold reason is any one of the reasons from the drop-down, the corresponding Child Incident Status is not getting automatically changed to OnHold. Because of this, the SLA is getting breached in our Child Incidents which is very critical.
Can anyone let me know how to fix this asap?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 04:25 AM
Hi Musab,
I didn't find any such Business Rule OOB for the link which you have provided.
I replaced my Instance Name but I can't find any.Can you please help me with the BR Name or it will be great if you can share with me the detailed script?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 04:32 AM
Please take this. Mark my answer as correct and close the thread. create the Same BR with same name and same order.
Name , when to run.
Conditions :
current.isValidRecord() && (current.incident_state.changes() || (current.incident_state == IncidentState.ON_HOLD && current.hold_reason.changes())) && (current.child_incidents > 0)
Script:
synchChildIncidents();
function synchChildIncidents() {
var updateChildState = false;
var updateOnHoldReason = false;
var ON_HOLD_REASON_AWAITING_CALLER = 1;
if ((current.incident_state.changes() && current.incident_state != IncidentState.RESOLVED && current.incident_state !=
IncidentState.CLOSED && current.incident_state != IncidentState.CANCELED &&
!(current.incident_state == IncidentState.ON_HOLD && current.hold_reason == ON_HOLD_REASON_AWAITING_CALLER)
) ||
(current.incident_state == IncidentState.ON_HOLD && current.hold_reason != ON_HOLD_REASON_AWAITING_CALLER)) {
updateChildState = true;
}
if (current.incident_state == IncidentState.ON_HOLD && current.hold_reason && current.hold_reason.changes() &&
current.hold_reason != ON_HOLD_REASON_AWAITING_CALLER) {
updateOnHoldReason = true;
}
if (updateChildState || updateOnHoldReason)
updateChildIncidents(updateChildState, updateOnHoldReason);
}
function updateChildIncidents(updateChildState, updateOnHoldReason) {
var gr = new GlideRecord("incident");
gr.addQuery("parent_incident", current.sys_id);
var lastReopenedBy = gs.getUser().getUserByID(current.reopened_by);
if (!lastReopenedBy.hasRole("itil,sn_incident_write"))
gr.addQuery("incident_state", "!=", IncidentState.RESOLVED);
gr.addQuery("incident_state", "!=", IncidentState.CLOSED);
gr.addQuery("incident_state", "!=", IncidentState.CANCELED);
var qc = gr.addQuery("incident_state", "!=", current.incident_state);
if(updateOnHoldReason)
qc.addOrCondition('hold_reason', "!=", current.hold_reason);
gr.addActiveQuery();
gr.query();
if (updateChildState) {
gr.setValue("incident_state", current.incident_state);
gr.setValue("state", current.state);
}
if (updateOnHoldReason)
gr.setValue("hold_reason", current.hold_reason);
gr.updateMultiple();
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2022 04:31 AM
Hi Musab,
Shall I inactive the existing BR which I created earlier?
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.addInfoMessage("Working fine");
var incident = new GlideRecord('incident');
incident.addQuery('parent_incident', current.sys_id);
// incident.addQuery('state', '3');
// incident.addQuery('hold_reason', '1');
incident.query();
while(incident.next()){
gs.addInfoMessage("Working fine fine");
incident.state = current.state;
incident.hold_reason = current.hold_reason;
incident.update();
}
})(current, previous);
And create a New BR with the new script which you have provided yesterday?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2022 05:05 AM
Hi Musab,
I have also one more last query that is this new script should work for all the OnHold Reasons as below.
Or it shall work only for Awaiting Caller? Can you please confirm this and let me know so that I can work on configuring the new script and mark your answer as Helpful for others.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2022 01:59 AM
Hi,
If your query is resolved please mark my answer as correct and close the thread.
Regards
Regards,
Musab