email processing

joedumond
Tera Contributor

What's the proper protocol for handling email replies to the instance?

When an incident is created, an email is sent.

When an incident is commented or worknoted, an email is sent.

I am seeing issues when someone replies to the incident notification.

It appears to happen when the Replier adds people to the To: or CC: line of the reply.

I can't quite narrow it down, and can't find the default email handling protocol for incident replies.

My best practice tells me that the Replier should leave the email alone and the body of the message becomes the comments.

If they want to add people that should be done through the watchlist of the incident.

1 ACCEPTED SOLUTION

Ahh - OK, I see. Forgive me if I start too far back this time.



Out of the box, ServiceNow uses the Inbound Actions to process email that comes into the instance. Email actions can be created for different message types - New, Reply or Forward. When an email message is received by ServiceNow, it checks for the watermark (the REF:xxxxxxx number at the bottom), and if the watermark exists, it knows what table the message is in relation to. It then checks for an Inbound Actions that matches the message type (New, Reply, Forward) and the table.



I think that gives enough basic background, if not let me know.



Your question is about replies to an Incident. If you open up your Inbound Actions you will see several items that relate to the "Incident" table. Out of the box, you will see one that handles replies ("Update Incident (BP)"). This Inbound Action determines what to do when an email reply is sent that relates to an Incident.



The code is this:


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.state = "2";


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


  }



  if (gs.hasRole("itil")) {


  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;


  }



  current.update();


}



Basically, what this does it append the incoming email to the "Comments" field of the Incident record that is referenced in the watermark. It also looks for a subject that contains "please reopen", and if found in the subject, reopens the Incident. There are some other actions there too, but I would recommend commenting them out (and I would comment out the "reopen" one) unless you really want to use them.



I think that covered what the system does, out of the box, when an inbound email arrives in reply to an existing Incident.



You can troubleshoot the emails you receive by going into the Email Log, opening up the email in question, and you will see which Inbound Action it triggered. This should help with your debugging if you find that something is happening you are not wanting/expecting. And, with the explanation above, hopefully it is easy to see how the Inbound Actions work so that you can edit them as needed.



I hope I didn't jump too far ahead again on you, and that this will help you troubleshoot what is happening with your inbound emails. If not, just let me know where I can expand!


View solution in original post

12 REPLIES 12

TrevorK
Kilo Sage

We handle all of the email replies (emails sent to the system) within the Inbound Email Actions. For example, if the email they are replying to is for a "Closed" Incident, we create a "New Call" record rather than update the "Incident". However, if the Incident was "Open" we append the reply to the Additional Comments, which then triggers outbound emails based on the events. When we append, we only append the reply itself and not the entire body, but when we create a New Call we attach the entire body (not just the replied text).



Perhaps I am not understanding your question, however the proper protocol for handling email replies should be based on your business processes, not on the system. With the Inbound Actions, ServiceNow is able to handle a wide variety of situations (such as performing different actions if the email address is in the CC field versus the TO field). What is a proper process should be based on your organization and their processes. Once you have these developed, you should be able to easily fit them into ServiceNow.



Every organization has it's own unique requirements, and you should look to have your solution meet those requirements rather than someone elses.



My apologies if my post does not answer your question. If there is anything further I can comment on or share (such as some code on Inbound rules you are having trouble with) please let me know!


Trevor,


What I am asking is:


What does the system do out of the box for inbound emails so that I can better understand what our population is doing (that's causing the creation of new incidents from replies) and then cater the system to their usage.


You are two steps in front of my original question.


Ahh - OK, I see. Forgive me if I start too far back this time.



Out of the box, ServiceNow uses the Inbound Actions to process email that comes into the instance. Email actions can be created for different message types - New, Reply or Forward. When an email message is received by ServiceNow, it checks for the watermark (the REF:xxxxxxx number at the bottom), and if the watermark exists, it knows what table the message is in relation to. It then checks for an Inbound Actions that matches the message type (New, Reply, Forward) and the table.



I think that gives enough basic background, if not let me know.



Your question is about replies to an Incident. If you open up your Inbound Actions you will see several items that relate to the "Incident" table. Out of the box, you will see one that handles replies ("Update Incident (BP)"). This Inbound Action determines what to do when an email reply is sent that relates to an Incident.



The code is this:


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.state = "2";


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


  }



  if (gs.hasRole("itil")) {


  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;


  }



  current.update();


}



Basically, what this does it append the incoming email to the "Comments" field of the Incident record that is referenced in the watermark. It also looks for a subject that contains "please reopen", and if found in the subject, reopens the Incident. There are some other actions there too, but I would recommend commenting them out (and I would comment out the "reopen" one) unless you really want to use them.



I think that covered what the system does, out of the box, when an inbound email arrives in reply to an existing Incident.



You can troubleshoot the emails you receive by going into the Email Log, opening up the email in question, and you will see which Inbound Action it triggered. This should help with your debugging if you find that something is happening you are not wanting/expecting. And, with the explanation above, hopefully it is easy to see how the Inbound Actions work so that you can edit them as needed.



I hope I didn't jump too far ahead again on you, and that this will help you troubleshoot what is happening with your inbound emails. If not, just let me know where I can expand!


great detail and information Trevor


Thank you!