Prevent closure of parent incident if any of the child tasks(problem, change, RITM) are open

Udit5
Tera Contributor

Hello All,

 

Suppose there is one parent incident which has 4 child incidents, those 4 child incidents has their own child task associated with them like problem,change, RITM and so on till n number of the branches.

I would like to prevent closure of parent incident if any of the child records are open in all the branches.

How Can I achieve this?

Kindly give hint.

 

Thanks

3 REPLIES 3

Yousaf
Giga Sage

Hi Udit,
Please check this thread if this could help.
Prevent an incident/problem from closing while tasks are open 

 

Mark Correct and Helpful if it helps.


***Mark Correct or Helpful if it helps.***

Udit5
Tera Contributor

This link does not help,

I need to check for all the task extended table.

Kindly help

Hi Udit,
You can try this then
1. Create a before update business rule on incident table
2. In condition Select state changes to closed
3. In the script try this script

(function executeRule(current, previous /*null when async*/) {
  var openTasks = new GlideRecord('task');
  openTasks.addQuery('parent', current.sys_id);
  openTasks.addQuery('active', true);
  openTasks.query();
  if (openTasks.next()) {
    gs.addErrorMessage('There are open tasks on this incident. Please close them before closing the incident.');
    current.setAbortAction(true);
  }
})(current, previous);

 

Mark Correct and Helpful if it helps.


***Mark Correct or Helpful if it helps.***