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

Hi, 

 

Thank you for your reply. 

I'm not able to open this link. 

 

Regards, 

Nivedita

 

 

Replace with your instance name no ? I'm able to open it, replace 'instance' part with your instance name

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

Hi, 

 

Thank you so much for your reply. 

There are many system properties available in both category and can you please explain me brief on that. 

Can you please tell me with only system properties incident task getting closed. 

 

Regards, 

Nivedita

 

 

Go to sys_properties.LIST then search for 'com.snc.incident.incident_task.closure' in Name field then open record and make 'Value' as 'true'

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

Hi, 

 

Thank you so much for your reply. 

I have some doubts here : 

1. We can close incident task when incident is closed with only system properties right and we don't need to create anything to achieve it. 

2. Can we close incident when all incident task get closed like we do for requested item. 

Can you please tell me what approach we should start to achieve it. 

 

Regards, 

Nivedita