- 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: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-11-2021 08:14 AM
I was looking at this
https://developer.servicenow.com/dev.do#!/learn/learning-plans/orlando/new_to_servicenow/app_store_learnv2_automatingapps_orlando_parsing_inbound_email

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2021 08:35 AM
Hi,
Thanks. I'm assuming that was maybe meant for a visual interpretation of the email, but I can definitely see how you'd think that's available, but I'm pretty certain it is not. I may be wrong though...could you try setting a JavaScript variable to that and then printing it to see if it does capture what you want?
Like:
var string = email.body.comments;
gs.info("***DEBUG: email body comments are: " + string);
And see if you get anything back?
I've given a good chunk of information above in my previous post, please let me know if you have any questions, etc.
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-11-2021 09:30 AM
Okay so I got it working with a combination of 2 things.
In the inbound email action script I put (from the link you sent) 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 per another comment) 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!