Sending email notification to user on no response and auto closing the incident

shonamac
Kilo Expert

Hi,

We have a policy with our customers that after a period of time with no response to their incident we will also close the incident and I'm trying to determine how we can implement this feature in servicenow.

Can I do everything through an email notification or will I have to build on 2 separate applications, like notifications and business rules for example?

Our current model is also set to autoclose incidents after 3 days if they were in a resolved state using system properties.

So firstly, we want to send an email notification to our users if there has been no response via email or case comment after say 2 days

Secondly we then want to change the state of the incident to closed (or resolved) afterwards

Appreciate any advice given to assist me here

Thanks

Shona

1 ACCEPTED SOLUTION

Travers M
Mega Guru

We use a method of auto closing incidents that are left in a custom need more information status for 7 days.   If a ticket is updated by anyone within that period, it resets the timer.   Below is the script that is used for that



var inc = new GlideRecord('incident');


      inc.addQuery('state', '10');


      inc.addQuery('sys_updated_on', '<=', gs.daysAgo(7));


      inc.query();


      while(inc.next()) {


      gs.eventQueue("nmi.closure", inc, inc.caller_id, gs.getUserName());


      inc.comments = 'Incident automatically closed after ' + 7 + ' days in a Need More Information status';


  inc.close_code = '5b07efae0f99a9007b0b918172050e3c'; // Unknown


  inc.close_notes = "Closed due to no reply.";


  inc.state = 7;


  inc.active = false;


  inc.update();


      }



From there, we have an email notification set up on the nmi.closure event with the details as to why their incident was closed


View solution in original post

12 REPLIES 12

Thats great to hear its helpful. If it helped you, please mark the answer as helpful, so that it will help to develop the community


Abdul Khan4
Kilo Guru

Hi Shona,



I would recommend to write a script to check the incident create time and state of incident. Add one field on Incident table (Not good approach) OR use any existing filed which you are not using for your customer. Run your script and update this new field as 'Mark auto close' if your above criteria met and send email to user using email notification with event method. Run again your script and close the incident which are marked 'Mark as auto close' and state not updated from last 2 days and close the incident.



Schedule above job which runs on daily basis on particular time interval. This script will check your criteria, update the field, send email to user and close the incident as required.



Please Click like, Helpful or Correct in answer makes sense to you




Hi Abdul,


The problem with using the incident create time is that this may not be an accurate reflection - we could have had numerous dialogues with the customer since the incident was created and then finally they stop responding to us.   I may take a look and see if we can use updated time or something like that



Thanks



Shona


Travers M
Mega Guru

We use a method of auto closing incidents that are left in a custom need more information status for 7 days.   If a ticket is updated by anyone within that period, it resets the timer.   Below is the script that is used for that



var inc = new GlideRecord('incident');


      inc.addQuery('state', '10');


      inc.addQuery('sys_updated_on', '<=', gs.daysAgo(7));


      inc.query();


      while(inc.next()) {


      gs.eventQueue("nmi.closure", inc, inc.caller_id, gs.getUserName());


      inc.comments = 'Incident automatically closed after ' + 7 + ' days in a Need More Information status';


  inc.close_code = '5b07efae0f99a9007b0b918172050e3c'; // Unknown


  inc.close_notes = "Closed due to no reply.";


  inc.state = 7;


  inc.active = false;


  inc.update();


      }



From there, we have an email notification set up on the nmi.closure event with the details as to why their incident was closed


Thanks Travers, very helpful



Do you also have anything in place that changes the state if a customer does reply within that period or do you just check all incidents under that state daily to manage them?



Thanks



Shona