update additional comments field with user mail reply

String
Kilo Sage

Hi Team,

when the user sends data throught mail,we are updating that respective details to the additional comments,but now user sending data in table format so  when the inbound action script is not updating the table format info properly 

So anyway to update the exact table format in additional comments which we received from the mail, Please guide me.

1 ACCEPTED SOLUTION

var messageContent = email.body_html;
if (messageContent.indexOf("From") != -1) {
messageContent = messageContent.substring(0, messageContent.indexOf("From")).trim();
} else {
messageContent = messageContent.trim();
}


current.comments = "[CODE]"+ messageContent;
current.update();

View solution in original post

31 REPLIES 31

you are using email.body_text which will convert body into text.

 

Instead use email.body_html which will retain the html of body 

okay after changing to email.body_html,we are getting below HTML data  

 

 
 
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<style type="text/css">.style1 {font-family: "Times New Roman";}</style></head><body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<table class="t1" style="border-collapse:collapse">
<tbody>
<tr>
<td class="td1" style="border-style:solid;border-width:1px;border-color:rgb(154, 154, 154);padding:1px 5px">
<p class="p1" style="margin:0px;font:13px &quot;Helvetica Neue&quot;">u_state</p>
</td>
<td class="td1" style="border-style:solid;border-width:1px;border-color:rgb(154, 154, 154);padding:1px 5px">
<p class="p2" style="margin:0px;font:12px Helvetica;min-height:14px"><br>
</p>
</td>
</tr>
<tr>
<td class="td1" style="border-style:solid;border-width:1px;border-color:rgb(154, 154, 154);padding:1px 5px">
<p class="p1" style="margin:0px;font:13px &quot;Helvetica Neue&quot;"><span class="Apple-converted-space">&nbsp;</span>u_number</p>
</td>
<td class="td1" style="border-style:solid;border-width:1px;border-color:rgb(154, 154, 154);padding:1px 5px">
<p class="p1" style="margin:0px;font:13px &quot;Helvetica Neue&quot;">...........co relation id</p>
</td>
</tr>
<tr>

You can update it additional comments it will retain the table structure 

after updating in comments it still not retained to the table format, as I ping above the same format only came to additional comments 

try  "[code]" + email.body_html