Auto Reply Email for Closed and Resolved Incidents

Community Alums
Not applicable

We'd like to send auto replies to users who reply directly to an incident resolve email instead of using the reopen link as well as any replies to incidents that are closed. There's topic I found that goes into some detail how to do this but we'd like to auto-reply to the person that sent the email rather than assume it is the caller because of the way we use the watch list. Has anyone done this before?

Thanks,

Aryanos

1 ACCEPTED SOLUTION

Aryanos,



In your script change to some thing like this:


  gs.eventQueue("incident.closed.autoreply", current, email.origemail, '');




The error you are getting is because, previous.state is not defined


View solution in original post

16 REPLIES 16

manikorada
ServiceNow Employee
ServiceNow Employee

Aryanos,



You can have a Inbound email action which will check for this reply and see if the Target is close or resolved and then accordingly generate an event which will generate an Email.


Community Alums
Not applicable

Hi Mani,



I've created the event (incident.closed.autoreply) but how do I pass the email.origemail email address to the event to send the notification?   This is what I have so far in the inbound email action. I also don't think I have the business rule correct for the event.



if(current.active == false){


        //auto-reply notification to caller


  gs.eventQueue("incident.closed,autoreply", current, current.state, previous.state);


  current.comments('User replied to a Closed incident. Auto-reply notification sent to the user');


}


There will be an Inbound Action 'Update Incident (BP)' which has a script like:


gs.include('validators');




if (current.getTableName() == "incident") {


  current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;




      if (email.subject.toLowerCase().indexOf("please reopen") >= 0) {


            current.incident_state = "2";


            current.work_notes = "The caller did not feel that this issue was resolved";


  }




  if (email.body.assign != undefined)


      current.assigned_to = email.body.assign;




  if (email.body.priority != undefined && isNumeric(email.body.priority))


      current.priority = email.body.priority;




  if (email.body.category != undefined)


      current.category = email.body.category;




  if (email.body.short_description != undefined)


      current.short_description = email.body.short_description;




  current.update();


}



This above Inbound action is responsible for updating the comments on the Incident when somebody replys back.


In this have a script something like:


if(current.active == false){


        //auto-reply notification to caller


  gs.eventQueue("incident.closed.autoreply", current, email.origemail, previous.state);


  current.comments('User replied to a Closed incident. Auto-reply notification sent to the user');


}



Now in your Email Notification, mark the 'Event Parm 1 contains recipient' as true.


Community Alums
Not applicable

Hi Mani,



Also, if possible can you go over the business rule associated with it? Not sure if mine is correct.