function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JoliJoli 

Textarea formatting lost

Hi all,

 

Apologies in advance if I've used some incorrect terminology here...this is my first foray into programming in about ten years.

 

I am trying to make a visualforce page that shows a combination of comments and emails for a particular Case in chronological order.

Using the sample code for Case History Timeline, I added some code that pulls the list of EmailMessages as well as what's already there.

 

The body of each Comment and Email is natively a textarea, but the history object populates then into a String (public string to), and I lose all of the formatting:

 

 

 

public class history {

    /* Properties of the class */
    public datetime historydt { get; private set; }
    public boolean ispublic   { get; private set; }
    public string actorname   { get; private set; }
    public string historyType { get; private set; }
    public string to          { get; private set; }
    public string fr          { get; private set; }

 

for (CaseComment comment:c.casecomments) { 
            if (!hidePrivate || comment.ispublished) {
                addHistory(histories, new history(comment.createdDate, comment.ispublished, comment.createdby.name, 'Comment Added', '' , truncateValue(comment.commentbody))); 
            }
        }

 

 

I tried updating the history class so that  "to" was defined as a textarea, but I got an error:

 

Error: Compile Error: Invalid type: textarea

 

I would be grateful for any advice or pointers!

 

thanks so much

Best Answer chosen by Admin (Salesforce Developers)