Trimm Inbound Email Script for Truncating Incoming Email Chain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 04:13 AM
Hi Community,
I have a requirement where I need to truncate the email chain in incoming emails. Only last email should be visible. I have tried the below code for this and trimmed 'from '
#. This just works fine with my User id( I can see only the latest email -but not truncated part ) - This should be the expected behaviour.Which
But When it is tested for other users, they are receiving the all email chain. I am not sure, how to fix this. Can somebody help ?
Here is my code for Update Incident ( Basically when User updates the incident, It should TRIMM all the incoming emails 'from' . I have tried email reply separators already , it does not help.
is There any better way to fix this ?
here is my code :
gs.include('validators');
if (current.getTableName() == "incident") {
var body = email.body_text;
/*
* The name of the sender of the message is stored in a property
* called glide.email.username. We want to leverage this when
* we strip off the original message.
**/
var system_user_name = gs.getProperty("glide.email.username");
/*
* Now look for the 'From: <System Email>' tag, so we can strip
* off the chain. ( ['F', 'r', 'o', 'm',':', ' '] = 6 )
**/
var beginInbound = body.indexOf(system_user_name) - 6;
if(beginInbound >= 0) {
// Strip off the original message
body = body.substring(0, beginInbound).trim();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 08:54 AM
There is an OOB feature for truncating email chains in additional comments.
The options can be found under System Policy > Email > Email Reply Separators
I have a config record for Outlook and one for gmail:
This feature is working for me in ITSM (incident), but It is not working for HR. That is what I am currently trying to figure out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2024 01:01 PM
What is your config for gmail? We have outlook replies sending only the reply but gmail is sending the entire conversation in the comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 01:28 PM
This is my config for gmail:
Separator: ^(On\s(.{1,500})wrote:)
Type: Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 01:30 PM
Thank you! We have that too and I cannot figure out why it is still posting the entire thread in the comments from an incident reply email. I just opened a case with ServiceNow to see.