Incident Not allowed to Close

Hitesh Ramba
Tera Contributor

Hi I have a requirement ...

 

Incident should not be allowed to resolve if there are any incident tasks in an open state ,and it show through an alert "Please close incident tasks before resolving the incident". Using Script make it possible and explain the complete process of how to do ...

 

Thank You!

2 REPLIES 2

Harish Bainsla
Kilo Patron
Kilo Patron

Hi @Hitesh Ramba   check below script

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

}

}

Mark Manders
Mega Patron

Why are you asking the same question three times? 

What did you already try yourself? What kind of assignment is this? Did you try something already, or are you just asking others to do your work for them?

https://www.servicenow.com/community/product-launch-forum/scripting-assignment/td-p/2918571
https://www.servicenow.com/community/product-launch-forum/incident-task/td-p/2919123

https://www.servicenow.com/community/product-launch-forum/incident-not-allowed-to-close/td-p/2919124

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark