
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 11:01 AM
I have an inbound action where I need to put the email body into the description field. How can I get it without all the HTML code but not loose the format?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 12:13 PM
I was able to do it with this code. We where only getting the <br/> as the html in the body.
var emailBody = email.body_html.toString().replace(/<br\/>/g, "\n");
current.description = emailBody;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 11:09 AM
Hello Brian,
In Inbound action, you can get email body with below code:
current.description = email.body;
OR
current.description = email.body_text;
You can open Create Incident inbound action to see the code
Check out this link for complete details:
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 11:21 AM
Yes I have done all that but it still put the HTML code into the description as well. I'm trying to get the body of the email into the description without the HTML code in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 11:30 AM
Use can use this: current.description = email.body_text;
Thanks,
Abhishek
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 11:33 AM
Hi Brian,
In this case, you can write regular expression to remove HTML tags. Something like below
var htmlString= "<div><h1>Hello World</h1>\n<p>It's me, Mario</p></div>";
var stripedHtml = htmlString.replace(/<[^>]+>/g, '');