+ Start a Discussion

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('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:








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?



Best Answer chosen by Admin (Salesforce Developers) 

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.


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.



Nice.  WOrks like a charm.  Thanks!

This was selected as the best answer