Cleaning Up Email Responses
Here is a cool trick I developed at some point.
This strips out the inline appendage most email systems put at the end of a reply, so all you get is the update, makes the work log much cleaner and easier to read…
gs.include('validators');
if (current.getTableName() == "incident") {
var body = email.body_text;
// Look for the 'From: System Email' tag, so we can strip off the chain.
// The -6 is added to remove the “From: “ portion of the message.
var beginInbound = body.indexOf(gs.getProperty("glide.email.username")) - 6;
if(beginInbound >= 0) {
// Strip off the original message and trim the whitespace.
body = body.substring(0, beginInbound).trim();
}
current.comments = "reply from: " + email.origemail + "\n\n" + body;
current.work_notes = "Inbound Email Response from " + email.origemail;
current.update();
}
https://glassputan.wordpress.com/2014/07/17/cleaning-up-email-responses/