- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 05:46 PM
Hi all,
I have a number of Inbound actions that process emails from customers. Among other things, the inbound actions typically grab the content of the email body, using email.body_text and put it in the description field of the new task.
Sometimes, customers include tabular data in the email, and it gets converted to text in the descrption field, but usually with a number of blank lines where the ends of table columns and tables would otherwise have been. Here's an example table:
This is some text | REF12345 |
Purpose of Email | Blah Blah Blah |
CI Details | |||||||
Name | Floor | Location | Address | Post Town/Code | |||
My_CI | A/E | na,na | |||||
B/E |
When the text gets added to the description fields, I see several blank rows between 'Blah Blah Blah' and 'CI Details'. I've been trying to remove excess blank rows with str.replace("\n\n", "") and str.replace("\r\r","") but I can't make them disappear. So I'm guessing the characters causing the blank rows are not actually new lines or carriage returns. Can anyone advise what characters might be being produced in the text where the HTML table tags would otherwise have been, causing the extra rows?
Jamie.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2017 03:42 AM
Hey jamie
To remove the new lines you can use :
var str = email.body_text.replace(/\n\n/g,"");
Regards
Mohamad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2017 02:54 PM
Hi Mohamad,
Thank you - I was missing the 'g'. School boy error!
Jamie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2018 01:41 PM
Hello,
Can you share how did you parse that email html table to inbound emails action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2018 10:21 AM
Hi
Did you get a solution to parsing html table to plain text in inbound emails?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 03:16 AM
HI ,
please suggest here
Inbound email on RITM table (sc_req_item)
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
parent.u_vodafone_response_powerdown = "Updates from Vodafone "+"\n\n"+"reply from: " + email.from + "\n\n" + email.body_text.replace(/\n\n/g,"");
parent.work_notes = "Updates from Vodafone "+"\n\n"+"reply from: " + email.from + "\n\n" + email.body_text.replace(/\n\n/g,"");
ritm.update();
}
still i receives like the below format , table format is not appearing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 05:42 PM
Hi
Did you find a solution/workaround? If so, can I ask how did you address it?
Thanks.