Created the search to get mail messages in plainte...
# suitescript
s
Created the search to get mail messages in plaintext but it returns the HTML string with the message, how can I get text-only
var messageSearchObj = search.create({
type: "message",
filters:
[
["case.internalid", "anyof", recordID]
],
columns:
[
search.createColumn({ name: "message", label: "Message" })
]
});
var searchResultCount = messageSearchObj.runPaged().count;
log.debug("messageSearchObj result count", searchResultCount);
messageSearchObj.run().each(function (result) {
var message1 = result.getValue({ name: "message", label: "Message" });
log.debug('inputText', message1.split("\n"));
return true;
});
O/P
<HTML><HEAD><BASE href='<https://9681245-sb1.app.netsuite.com/>'><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></HEAD><BODY style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10pt;"><p>Test mail</p></BODY></HTML>
a
The NetSuite email/message record stores the body as it is, if the body (+ mime type) = HTML, it will store the full HTML, if the body is plain-text it will store the Plain Text, there is no out of the box search or functionality to strip the text from the HTML as far as I know, you will need to build a parsing function to do that if HTML is detected.
1