Strip off email disclaimer on Inbound Email Action

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2008 03:03 PM
I'll preface this by saying I'm still very much a beginner javascript developer, but does anyone have a script in their Inbound Email Action to remove a standard email disclaimer?
I figured it is a quite common request, particularly when the business users are emailing in incidents. Can the "Create Incident" incident detect the string "Legal disclaimer:" and ignore adding the rest of the email body into the additional comments field.
I'm unable to find the particular example I'm looking for on the wiki (useful scripts, inbound email action examples) or this forum. http://wiki.service-now.com/index.php?title=Inbound_Email_Action_Examples
Thanks guys.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2008 03:06 PM
brenb
Create Incident action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2008 03:28 PM
System Properties --> Email Properties, look for the following property:
" For reply emails, discard everything below this text if found in message body"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2008 04:33 PM
Thanks mate. Yeah I've been trying this property.
This config is for -reply- emails into the system though, not new emails for incidents being initiated by the users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2008 08:41 AM
For new emails, you might have to do your own JavaScript string parsing in the Inbound Email Action. You'd need to make use of the indexOf(), either substr() or substring() (I always forget the difference and have to Google them every time I need them), and set current.comments to be a new string you make out of email.body_text instead of using the default current.comments line in the inbound email action.
Something like:
// idx will be the position of the text you're looking for
var idx = email.body_text.indexOf('your delimiting text here');
// s will be the substring from the beginning to the start of your text
var s = email.body_text.substring(0,idx);
current.comments = "received from: " + email.origemail + "\n\n" + s;
You'll need to tweak this, probably.