- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2017 06:16 AM
So, I have a formatted email hitting our SNow instance which we rip some of the info out from to complete various fields BUT the last section of the email is a free text section from where is comes so it have carriage returns etc in it over multiple lines.
I need to get the system to either read the section and print it in the detailed description section OR trim the first part of the email and only give me the last section. Is this possible, here is an example email body:
Submitted on Monday, 27 November, 2017 - 13:12
Title (Mr, Mrs, Dr, etc):Mr
First name:Joe
Last name:Blogss
Email address:jb@hotmail.com
Enquiry type:Product query
Additional information:
Hi,
I was just wondering if it is possible to have a latte waiting for me when i arrive on site.
Thanks,
Dave
We use sections 'Title (Mr, Mrs, Dr, etc):', 'First name:', 'Last name:', 'Email address:' & 'Enquiry type:' to complete various fields.
I need to make the detailed description whatever is after 'Additional Information:'
Can this be done
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2017 07:53 AM
Here's the answer in-case anyone can find it useful, a find and replace:
var bodyText = email.body_text; // getting the text
if (!bodyText)
bodyText = email.body_html;
var sample = bodyText; //putting it into a string
var substr = sample.substring(sample.indexOf('Additional information:')); // replace everything before Additional information:
current.description = "Received from: " + email.origemail + "\n\n" + substr; // write it to the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2017 06:29 AM
Hi Dave,
Did you try using something as below
current.comments = email.body.additional_comments; //considering the above format of mail.
gs.log('Additional comments are ',email.body.additional_comments);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2017 07:53 AM
Here's the answer in-case anyone can find it useful, a find and replace:
var bodyText = email.body_text; // getting the text
if (!bodyText)
bodyText = email.body_html;
var sample = bodyText; //putting it into a string
var substr = sample.substring(sample.indexOf('Additional information:')); // replace everything before Additional information:
current.description = "Received from: " + email.origemail + "\n\n" + substr; // write it to the field