Resolved incident should be closed after 72 hrs

sonita
Giga Guru

I have this requirement to -->Resolved incident should be closed after 72 hrs

is there an out of the box business rule?

1 ACCEPTED SOLUTION

BALAJI40
Mega Sage

go to system properties -> system


we fill find one property


we can give the days: 3


View solution in original post

6 REPLIES 6

BALAJI40
Mega Sage

go to system properties -> system


we fill find one property


we can give the days: 3


Hi BalajiReddy,

 

Could you please tell me will the clock run on weekends also ?

arnabwa
Giga Guru

Hi Soni,



I have this Scheduled job for auto work on incidents. You can easily build your code in line with this code. Follow my comments on code lines and also make necessary changes in variable values :



var inc = new GlideRecord('incident');


inc.addQuery('incident_state',4);


inc.query();


while(inc.next())


{


var nowdt = new Packages.com.glide.glideobject.GlideDateTime();


nowdt.setDisplayValue(gs.nowDateTime());




var cur_date = nowdt.getNumericValue();




var start = inc.u_awaiting_user_timer.getGlideObject().getNumericValue();


  if(start!=0)


                          {


 


                              var diff = (cur_date - start)/ (1000*60*60*24); // @Soni   = you have to keep these to hours


  if( (diff >= 7 && diff < 😎 || (diff >= 14 && diff < 15 )) // @Soni   = I had a requirement to send notification reminders.You can skip this


 


                          {


                          var event = "incident.awaitinguserinfo.reminder";


                          gs.eventQueue(event,inc,inc.caller_id,inc.caller_id);


                          }


  if(diff >= 21) // @Soni = Use 72 hours here



                    {


                    inc.incident_state = 6; // Use closed state value here


    inc.comments = 'This service request is being automatically resolved by the system due to one or more of the following reasons:' + '\n' + '- The requester did not respond with the additional information requested by the support person within three weeks OR' + '\n' + '- The approver did not respond within three weeks.';


                    inc.close_code = 'Solved (No User Response)';


                    inc.close_notes = 'Incident auto resolved after attempting to contact the requestor for response over the last 3 weeks.';


                    inc.update();


                    }


 


                          }


}



Please let me know if you face any problem.



Thanks,


Arnab