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

Pranesh072
Mega Sage
Mega Sage

can you share your email body and inbound action ?

below inbound action:

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


current.comments = messageContent;
current.update();

 

Email from the user as below table format is attached below

 

can you try this script and share the log result?

 

var messageContent = email.body_text;

gs.log("line 1"+messageContent); 
if (messageContent.indexOf("From") != -1) {
messageContent = messageContent.substring(0, messageContent.indexOf("From")).trim();

gs.log("line 2"+messageContent); 

} else {
messageContent = messageContent.trim();

gs.log("line 3"+messageContent); 

}


current.comments = messageContent;
current.update();

line 1u_state


u_number

...........co relation id

u_configuration


u_work_notes


u_caller


u_impact


u_short_description


u_opened_by


________________________________
From:abc.com
Sent: 11 January 2021 17:37
To: sbc@com
Subject: Re: EXT || New Incident number INC123 - test

attachment





u_state


u_number

...........co relation id

u_configuration


u_work_notes


u_caller


u_impact


u_short_description


u_subcategory


u_inc_number

……….XOS ticket number

u_additional_comments


u_source

Contact type

u_category


u_urgency


u_assignment_group


u_description


u_opened_by



 

 

line 2u_state


u_number

...........co relation id

u_configuration


u_work_notes


u_caller


u_impact


u_short_description


u_opened_by