Auto resolve case when related inc and chg is resolved and closed

Alex D Great
Tera Contributor

Hi community

I have this current challenge where I need to auto resolve case (parent) when related inc AND/OR chg, req (childs) are resolved and closed. 

I manage to auto resolve case when only incident is resolved, however, when a second task type is related it becomes harder. Any help is highly appreciated.

6 REPLIES 6

johnfeist
Mega Sage
Mega Sage

Hi Ahn,

It sounds like you are using a pointer in either the incident or parent to resolve the incident.  If you don't have a similar pointer in the change record there probably isn't a reliable mechanism for closing the parent.  If that's the case then your best option is to create the relationship so that going forward you will be able to meet the requirement.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Mike_R
Kilo Patron
Kilo Patron

If you have existing relationships between the records, you can create a business rule or flow to close them.

Can you share more info regarding how the relationships are setup, what you already tried, and where you're getting stuck?

Hi Mike

I am little unsure if i reply this correctly. But the relatikonships is that case is always the parent, where change and incident always will be the child.

This is the current script I have which is only resolving the auto close when the incident is resolved (which is not solving my challenge):

BR
Table: task
When: After update

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

var caseGr = new GlideRecord("sn_customerservice_case");
caseGr.addQuery("incident",current.sys_id);
caseGr.addActiveQuery();
caseGr.query();

while(caseGr.next()) {

caseGr.state = 6; // resolved
caseGr.update();

}

})(current, previous);




jaheerhattiwale
Mega Sage
Mega Sage

@Alex D Great Write 2 business rules as follows

1. Business rule on incident

When incident is resolved/closed

Check if at least one open (not resolved/closed) 'change request' which is associated same case as of incident is present.

If present then don't close the case. If not then close the case.

 

2. Business rule on 'change request'

When 'change request' is resolved/closed

Check if at least one open (not resolved/closed) incident which is associated same case as of 'change request' is present.

If present then don't close the case. If not then close the case.

 

Please mark as correct answer if this solves your issue

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023