Once Parent Incident Status Changes, Child Ticket Status Should Change automatically for all the states

SNOW46
Tera Contributor

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

15 REPLIES 15

Not required. Check the code and Mark my answer as correct

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hello Musab,

Still its not working?? Even I changed the Parent Incident State to OnHold and Onhold Reason as Awaiting Caller, Child Incidents states are still in InProgress.

Thanks

Ok got the issue now, please check the working code, Mark my answer as correct after validation. Please note there is OOB script which is making this change when on hold reason is not Awaiting caller hence you need script only for this condition ok.

Script :

(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);

 

Condition:

find_real_file.png

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hello Musab,

Excellent!!! It worked for me finally...The Script has been executed and pop-up the info message as well, I have one more doubt here like again if I change the State from On-Hold to InProgress for Parent Incident the Child Incident stays as it is in OnHold State.

 

Can you please help me here as well for this scenario?

 

Thanks

Don't you have this OOB business rule in your instance.? this is working well for me

https://yourinstance/sys_script.do?sys_id=eb8fa5b00b3332001604628393673a96&sysparm_view=&sysparm_record_target=sys_script&sysparm_record_row=2&sysparm_record_list=collection%3Dincident%5EORcollectionINincident%2Ctask%5EORDERBYDESCsys_updated_on&sysparm_record_rows=70

Please hit like and mark my response as correct if that helps
Regards,
Musab