+ Start a Discussion
SFineSFine 

Trouble adding to a long text

I'm having a bit of trouble getting a syncing feature to work.

 

Basically, it's getting information from several Long Text Area fields on the product level to one other field on the quote level.

 

I got it most working, but I'm having two problems.

 

One involves the quote level field started with ther word 'null' before putting the other notes in and the other is instructing a new line command "+ '\n' " but not actually making a new line.

 

Any ideas? Thanks in advanced

hitzhitz

Hi, SFine

 

question 1 :) the quote level field started with ther word 'null' before putting the other notes in

try to implement like this ...

 

if(Note == null){
             Note = Note.Body;
         }
         else{
             Note +=  ','+Note.Body;
         }

 

Question 2:) is instructing a new line command "+ '\n' " but not actually making a new line.

For that you need to replace '\n' with html br tag need to convert it into html format for both storing and also while retriving data.

try this...

accountObj.sticky_Note__c = accountObj.Sticky_Note__c.replace('\n','<br/>');

 

hope this wil helps you..

SFineSFine

The first part of your solution works, but, I'm a bit confused about the second part. So when you're putting the information in, it'll be +'\n' but when you're retrieving the information you change the \n to <br/>? Is that correct?

hitzhitz

hi,

 

This is correct i have use this code for storing Sticky note body.

 

you have to just replace \n with '<br />'..

can u share ur code ???

SFineSFine

Sure thing.

for(QuoteLineItem ql:qls){
     if(ql.PricebookEntry.Product2.Product_Configuration_Notes__c!='null'){
       if(quo.Configuration_Notes__c==null)
           quo.Configuration_Notes__c=ql.PricebookEntry.Product2.Product_Configuration_Notes__c;
       else if(quo.Configuration_Notes__c!=null)
           quo.Configuration_Notes__c+=ql.PricebookEntry.Product2.Product_Configuration_Notes__c+' ';
     }
     
}

SFineSFine

Actually, I half figured out the problem. The only thing now is when I put it in a pdf, it doesn't break lines and when replacing the \r (which is what I needed to do) with <br/> it just prints out the <br/> normally.

 

The code for this is like so:

 

opp.configuration_Notes__c=opp.configuration_Notes__c.replace('\r','<br/>');