When parent incident is resolved, not all children resolved

eileenhessmille
Kilo Expert

When the parent incident was resolved, it auto-resolved 148 child incidents, but did not auto-resolve 33 child incidents. There is nothing unusual about the remaining children, and since we recently cloned our training instance, I was able to test there. I set the parent back to 'Assigned', then to 'Resolved', and the remaining records were then resolved.

I hesitate to perform that fix in production without knowing why it happened in the first place. Anyone experience something similar?

Thanks!

6 REPLIES 6

You can add logging into your resolve business rule that essentially says resolving 1 of 178, and so forth, and you can see what the status is.   As was mentioned, it takes awhile to close that many incidents, maybe it was still in progress?



function resolveChildIncidents() {


  var count = new GlideAggregate('incident');


  count.addAggregate('COUNT');


  count.addQuery('parent', current.sys_id);


  count.query();


  var incidents = 0;


  if (count.next()){


  incidents = count.getAggregate('COUNT');


  }


  var incident = new GlideRecord("incident");


  incident.addActiveQuery();


  incident.addQuery("parent", current.sys_id);


  incident.addQuery("incident_state", "!=", "6");


  incident.query();


  var msg = "";


  var counting = 0;


  while (incident.next()) {


  gs.log('Closing incident ' + counting + ' of ' + incidents + ' incidents.', '$$$$ - Admin');



  incident.incident_state = 6;


  if (incident.close_notes.nil()) {


  msg = "Close notes copied from Parent Incident";


  if (current.close_notes.toString().indexOf(msg) == 0)


  incident.close_notes = current.close_notes;


  else


  incident.close_notes = msg + ": " + current.close_notes;


  }


  incident.close_code = current.close_code;


  msg = "Resolved based on resolution of Parent Incident.";


  if (current.comments.toString().indexOf(msg) == 0){


  incident.comments = current.comments;


  }else{


  incident.comments = msg + " " + current.comments;


  }


  incident.work_notes = current.work_notes;


  incident.update();


  counting++;


  }


}


Thank you, Mike. If it happens again, I will suggest we add the logging. For now, I'm hoping it's a 'one-off'.