The CreatorCon Call for Content is officially open! Get started here.

Inbound Action to trim inbound email

Chuck Tomasi
Tera Patron

I'm looking for a way to trim either the activity history on an outbound message or the incoming reply.

Our company is email happy and this has cause some problems. By default, adding ${comments} to a mail notification includes everything. As a result, someone who hits reply, sends all that stuff back and it gets add to the activity history. When an itil person adds a comment to an incident, for example, the notification is now exponentially longer and longer and longer. After a dozen responses back and forth, the activity history becomes useless.

Does anyone have any suggestions how to control these really long tickets (other than telling people to manage their replies better)?

19 REPLIES 19

FWIW, The Email property "For reply emails, discard everything below this text..." did the trick. I added the replaced the "--Original Text--" with the proper delimiter and it worked perfectly. No more 10 mile long activity histories (unless there is a whole lot of activity.

Thanks for the help.


geannaweed
Tera Contributor

The script works but it started to screw up targets for the incoming emails in service-now's inbox, hence no tickets are getting updated.

It worked for sometime, then for awhile, target became blank. I don't see what's wrong with this?
var resp = email.body_text.indexOf('From: ');
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text.substring(0,resp);


If the "discard below this text" email property doesn't work, you'll have to use regular expressions to exclude the "Ref:MSG0044568" watermark info.


geannaweed
Tera Contributor

What if there's no watermark on the emails? Just a simple email reply? Pls help!


Sorry, I don't understand what you're looking to do. Can you explain?

Per the wiki:
The email contains one of the following conditions and the table specified in the email matches the table of the inbound action:
1. A valid watermark that matches an existing record.
2. An In-Reply-To email header (when no watermark is present) that matches an existing record.
3. A subject line starting with a recognized reply prefix (when neither a watermark nor an In-Reply-To header is present) and a valid record number that matches an existing record.

Source: http://wiki.servicenow.com/index.php?title=Inbound_Email_Actions#Matching_Incoming_Email_to_an_Inbound_Action_Type