- 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-01-2017 05:51 PM
I should add... also getting blank rows between 'Purpose of Email' and 'Blank Rows'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 11:23 PM
Hi Jamie
The instance will convert the HTML to Text as soon as the email arrives. One more thing you can try is to enable the HTML Sanitizer :
New lines might be '\r\n' when you are searching for them
Regards,
Mohamas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2017 10:09 AM
Hi Mohamad,
Thank you for your reply. I think I wan't very clear with my original question. My issue is that when the system extracts the text from an email body containing HTML tables, superflous rows are added where the table related HTML tages would have been. So for instance, I have an Inbound Action linked on the incident table, with a script to put the text content of the email body into the description field:
var desc = email.body_text;
current.description = desc;
current.insert();
If I process an email with this body:
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 |
I get the very 'spacey' text below the three dashed lines below, in the description field of the incident. My question is how I do remove those extra line feeds?
Thank you
Jamie
---
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
- 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