I want to close incident task when incident is closed.

niveditakumari
Mega Sage

Hi, 

 

I want to close incident task when incident is closed. When anyone close incident then it should check incident task has been closed or not if it incident task has been closed then incident should closed. 

Can anyone please help me with this. 

 

Regards, 

Nivedita

 

 

2 ACCEPTED SOLUTIONS

RaghavSh
Kilo Patron

create an after update BR on incident table with condition state changes to closed, with below script:

var inc = new GlideaRecord('incident_task');
inc.addQuery('incident',current.sys_id);
inc.addEncodedQuery('stateIN-5,1,2');   // will check if task is not closed
inc.query();
while(inc.next())
{
inc.state=3;  // will close the task
inc.update();
}


Please mark the answer correct/helpful accordingly.

 


Raghav
MVP 2023

View solution in original post

Point 1 can be controlled with Property I have mentioned, no additional thing is needed. For point 2 you need business rule , you can see below thread it has working code.

https://www.servicenow.com/community/it-service-management-forum/auto-close-incident-when-incident-t...

Feel free to accept multiple solutions if your query is answered.

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

View solution in original post

10 REPLIES 10

Point 1 can be controlled with Property I have mentioned, no additional thing is needed. For point 2 you need business rule , you can see below thread it has working code.

https://www.servicenow.com/community/it-service-management-forum/auto-close-incident-when-incident-t...

Feel free to accept multiple solutions if your query is answered.

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