- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2021 05:28 PM
Hi,
I am trying to do an inbound email action to update a field called progress notes with an e-mail reply but the reply only and not include the original e-mail it was replied from.
From researching it looks like I need email.body.comments
I tried this under actions - script
current.progress_notes = email.body.comments;
current.update();
It didn't work but when I did this worked but included the entire e-mail thread. I just want what the REPLY is.
current.ait_progress_notes = email.body_text;
current.update();
Thank You!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2021 06:25 PM
Hello,
Unfortunately, there isn't a universal "email.body.comments" as a normal email object accessible. Please refer to documentation regarding the available objects with variables: https://docs.servicenow.com/bundle/paris-servicenow-platform/page/administer/notification/reference/... you're perhaps reading other threads and mistakenly taken that away from those threads. email.body.something...for example is basically looking for that as a prefix within the email and would then capture the text beside it. So if the email said:
"Hi Steve,
how are you?
Details: blah blah blah"
I could use email.body.details in the inbound action script to then grab the "blah blah blah", for example.
For trying to get the latest reply/information only, please check out this thread: https://glassputan.wordpress.com/2012/03/08/managing-email-replies/
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2021 06:32 PM
Ok so I think what you need is if you go to sys_properties_list.do look at the property called "glide.pop3.reply_separators" you might have to make changes to it because different email clients use different reply separators.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2021 08:18 AM
Here is what I have under value: \n\n-----Original Message-----,\n\n _____ \n\nFrom:
This is what is appearing coming from inbound email action. I get the replied message first and then underneath there it starts with "From"
From:
Sent:
To:
Subject:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2021 09:27 AM
Ok so what I would do is find an existing reply record in sys_email_list.do and from the list view copy the body text field (not the body field). Then paste it into this tool https://www.freeformatter.com/javascript-escape.html
and escape it. Then you can see what the delimiter is between reply body and original message and use that to update the system property.
Also keep in mind that this will affect all reply emails in the instance. But I can't think of any use case where you wouldn't want this discarded as if the email is classified as reply rather than new the previous correspondence would already be in snow from the previous inbound email.
But if that wasn't the case for any reason you would need to use regex.replace in the inbound action for this use case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2021 09:32 AM
Okay so I got it working with a combination of 2 things.
In the inbound email action script I put (that Allen posted) I like this because it includes the e-mail address of who it's from and it gives it a cleaner look.
if (current.getTableName() == "table name") {
var body = email.body_text;
/*
* The name of the sender of the message is stored in a property
* called glide.email.username.
**/
var system_user_name = gs.getProperty("glide.email.username");
/*
* 'From: <System Email>' tag, 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();
}
/* Other Actions Here */
current.progress_notes =
"reply from: " + email.origemail + "\n\n" + body;
current.update();
}
I updated the system property glide.pop3.reply_separators (as you suggested) and I changed the value to just "from:" as that's how the email comes in.
Between these 2 it works perfectly!!!
Thank you so much!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2021 07:03 PM
The best way to solve this problem is to move from email to self-service, which has a distinct comment field!
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022