Awaiting User Info state and automatically changing to resolved state

Dr_Bruce
Kilo Expert

Notes on Auto Resolve when in Awaiting User Info state


What we wanted: when in the Awaiting User Info state, the user is prompted for a reply after 3 days, and if no response after a further 2 days, the call is moved into the Resolved state.

There's been a number of other posts about this that haven't really worked for us, the sticking point was the auto resolve scheduled job section as the automatic notification of 'hey you, respond to us' reset the counter so nothing ever got to 5 days and was resolved.

Our solution, which works (at least for us), uses the SN metrics rather than the sys_updatedon field that other community posts have suggested.


Other community posts about this:

https://community.servicenow.com/message/707797#707797

https://community.servicenow.com/message/671415#671415

https://community.servicenow.com/message/669062#669062



1.Business Rule for moving from state4 (Awaiting User Info) to state=1 (in progress) if a response is received.

2. Set up an Inactivity Monitor

inactivity monitor: http://wiki.servicenow.com/index.php?title=Setting_Inactivity_Monitors


This counts the number of days a call hasn't been updated.

3. Set up a notification

We set this to just send to the Caller.

4. Scheduled job to resolve if no response

This uses the built in metrics: and is set to run at 1am each morning. http://wiki.servicenow.com/index.php?title=Metric_Definition_Support

var ps = 5;

var pn = parseInt(ps);


if (pn > 0) {

  var inc = new GlideRecord('incident');

  // Change all Awaiting User Info(4) incidents to Resolved(6)

  inc.addQuery('incident_state', 4);

    while (inc.next()) {

    var updated = "";

    var metric = new GlideRecord("metric_instance");

    metric.addQuery('definition', '35f2b283c0a808ae000b7132cd0a4f55'); // Incident State Duration metric

    metric.addQuery('id', inc.sys_id);

    metric.addQuery('value', 'Awaiting User Info');

    metric.orderByDesc('start');

    metric.query();

   

    if (metric.next()) {

      updated = metric.start;

    }

      if (updated != "" && updated < gs.daysAgoStart(pn)) {

    inc.incident_state=6;

      inc.comments = 'Incident automatically Resolved after ' + pn + ' days in Awaiting User Info state.';

      inc.work_notes = 'Incident automatically Resolved after ' + pn + ' days in Awaiting User Info state.';

      inc.u_resolve_codes='Business Systems';

      inc.u_resolve_code_2='ServiceNow';

      inc.u_resolve_notes='Closed awaiting user response.';

      inc.update();

    }

  }

}



9 REPLIES 9

Prabeen Manandh
Tera Expert

Hi Bruce,



I used your steps above, reminder works but it won't resolve the incidents if no response after x number of days. Resolving script is placed on "Scheduled Job". any idea what the issue is?



Thanks,



Prabeen (SN newbie)


I had the same trouble, after a fair chunk of debugging I found the error.



The line: inc.addQuery('incident_state', 4);



Needs this below it: inc.query();



You may also need to change some of the other fields to match your customisations, such as the state fields, close notes etc.


Thanks Dave. But I fixed this adding a separate field which records the date only when the state changes to "AUI" and calculate the days according to that date instead of sys update date.


Prabeen Manandh
Tera Expert

Above script doesn't return anything even while executing with just using gs.mintuesAgoStart(pn) just to test. What i am doing wrong? Any help would be appreciated. Thx.