Incident should not resolved if any task are pending or open. once all the tasks are closed then only Incident can close/Resolved.

Veera raju
Tera Expert

Hi,

Incident should not resolved if any task are pending or open. once all the tasks are closed then only Incident can close/Resolved.

For example: 

In an Incident there are 3 tasks are there if 2 tasks are closed and one is open/pending then if i close that incident it will not going to close.

Once all the tasks are closed then only Incident is get closed.

 

Please help me on the same.

1 ACCEPTED SOLUTION

Hi, 

Try with below code

(function executeRule(current, previous /*null when async*/) {

// Add your code here
var gr=new GlideRecord('incident_task');
gr.addQuery('incident',current.sys_id);
gr.addQuery('active',true);
gr.query();
if(gr.next())
{

current.setAbortAction(true);
gs.addInfoMessage("incident can not be closed untill all incident tasks should be closed or resolved");

}

}

Regards,

Pooja

View solution in original post

8 REPLIES 8

HarshTimes
Tera Guru

You need to write a "on before" update business rule. In this business rule, write a script to query the incident task table with a filter as status is not closed. If the script returns any record then you need to set the script to abort the update action and show an error message that the related task is open.

 

-harsh

Hi,

Could please provide me the code.

Pooja Mallikarj
Kilo Sage

Hi Veer raju,

Write Before update Business rule on incident table

And put condition as state changes to Resolved

write below script in script field

(function executeRule(current, previous /*null when async*/) {

// Add your code here
var gr=new GlideRecord('incident_task');
gr.addQuery('incident',current.sys_id);
gr.query();
if(gr.next())
{
current.setWorkflow(false);
gs.addInfoMessage("incident can not be closed untill all incident tasks should be closed or resolved");
current.setAbortAction(true);
}

})(current, previous);

 

Mark correct/helpful if it helps for you

Regards,

Pooja

find_real_file.png

 

even i closed all the respective task again it is showing same error only.

 

find_real_file.png