Incident Auto close issue

SNOW User8
Giga Guru

Hello All,

We have the default Scheduled job &   business rule to auto close the silent "Resolved" incident after 3 days.

It's working fine for all users except one user.

We tried to find out the exact issue, but scheduled job and business rules are fine & running daily.

What is the problem behind this?

Could anyone help me with this?

Regards,

Anna.

13 REPLIES 13

vab_13
ServiceNow Employee
ServiceNow Employee

So do you mean Scheduled Job gets triggered and BR executes but incident doesn't get closed if requested-by has got that one special user?


Are you sure BR is actually passing all defined conditions?


My recommendation is to place gs.log/gs.info statements in BR and validate the logs if it's passing the defined logic there.



To me, it appears to be a pure debugging case, just require more debugging.


My guess it, BR might not even reach that part of the code which updates/commits the required update.




Mark your feedback( Like or Helpful or Correct) as per the impact of my response. Cheers!


Vab


hi Vab Singhal,



The Scheduled Job & BR is working good. Why, because all silent "Resolved" incident more than 3 days getting closed in my instance except few incidents.


Gurpreet07
Mega Sage

Hi Anna,



Did you created a custom field to store incident resolved time stamp? If your logic is based on updated time stamp then it may not work as expected. Some times the work notes/ comments could be updated for a resolved incidents as well and hence logic may not work as expected.


Hi gurpreet ,



Please find the incident auto close incident below,



autoCloseIncidents();


function autoCloseIncidents() {


var ps = gs.getProperty('glide.ui.autoclose.time');


var pn = parseInt(ps);


var queryTime = new GlideDateTime();


queryTime.addDaysUTC(-pn);




if (pn > 0) {


var gr = new GlideRecord('incident');


gr.addQuery('incident_state', IncidentState.RESOLVED);


gr.addQuery('sys_updated_on', '<', queryTime);


gr.query();


while(gr.next()) {


gr.incident_state = IncidentState.CLOSED;


//   gr.comments = 'Incident automatically closed after ' + pn + ' days in the Resolved state.';


gr.active = false;


gr.closed_by = gr.resolved_by;


gr.update();


}


}


}


But the "Unresolved incident's" last update is 2 weeks now.



What can I do to overcome this issue?