Auto-close Case if the Child Incident or Child Request is closed

Jimmy45
Giga Guru

Hi Community,

I am having a real hard time with a customer request.  They are asking me to put together a business rule where If a Case in sn_customerservice_case has a child ticket (Request or Incident) then if the Child Request or Incident are placed in "Closed Complete" (for request) or "Resolved" (for incident) then to auto-close the Case (parent)

Can someone show me at least a good start to what that code looks like?  I would be most appreciative to help me get started.

 

 

1 ACCEPTED SOLUTION

Thiagofmeira
Kilo Guru

Hey Jimmy,

I believe this code will help you.

It can depend how you are connecting the tickets, because for some cases as Requests, the tickets are connected by the field "Parent"

 

See an example for incident

 

var caseGr = new GlideRecord("sn_customerservice_case");

caseGr.addQuery("incident", current.sys_id);
caseGr.query();

while(caseGr.next()) {
   caseGr.state = 6; // resolved
   caseGr.update();

}

 

Please, mark this answer as correct if it helps you

 

View solution in original post

1 REPLY 1

Thiagofmeira
Kilo Guru

Hey Jimmy,

I believe this code will help you.

It can depend how you are connecting the tickets, because for some cases as Requests, the tickets are connected by the field "Parent"

 

See an example for incident

 

var caseGr = new GlideRecord("sn_customerservice_case");

caseGr.addQuery("incident", current.sys_id);
caseGr.query();

while(caseGr.next()) {
   caseGr.state = 6; // resolved
   caseGr.update();

}

 

Please, mark this answer as correct if it helps you