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
StephenDavidsonStephenDavidson 

cr/lf stripped out by article.put or in query result field -- not sure which.

I am using the article customization class AgentContributionArticleController to pull subject and description and the latest case comment into the title and summary and a custom rich text field in articles.  This customization is invoked upon case close.

 

        Case c = [select subject, description,casenumber from Case where id=:sourceId];
        CaseComment cc = [select LastModifiedDate, LastModifiedBy.Id, LastModifiedBy.Name, IsPublished, CreatedDate, CreatedBy.Id, CreatedBy.Name, CommentBody From CaseComment where ParentId = :sourceId order by LastModifiedDate desc limit 1];
        if (article instanceof case_summary__kav){
     
            article.put('title',c.subject);
            article.put('summary',c.description);
            article.put('resolution__c',cc.CommentBody);
            article.put('Originating_Case__c', +c.casenumber); 
            article.put('Originating_Case_URL__c',+'http://cs4.salesforce.com/' +sourceId);  
          
        }

The problem is, when I have text in my latest case comment, like this:

 

this

is

my

formatted

text

 

It translates into the custom rick text field in my article as this:

 

this is my formatted text.

 

Salesforce says this is by design.  Looks like a bug, smells like a bug.......

 

Anyone know of a workaround?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
StephenDavidsonStephenDavidson

Nice.  WOrks like a charm.  Thanks!

All Answers

Suresh RaghuramSuresh Raghuram

Its just an idea to share with you not a solution.

 

 

Is there any thing like this \n which leads to new line in your previous existing code check it out . Removing that and appending the result in a single line with space could solve your problem.

 

If this solves your problem make this as a solution.

francoisLfrancoisL

You can can try to replace end of line characters by <br/> since you convert a text field to Rich Text Field. I never test it.

 

StephenDavidsonStephenDavidson

Nice.  WOrks like a charm.  Thanks!

This was selected as the best answer