+ Start a Discussion

Copying contents of long text area fields

I have an scontrol that essentially clones an opportunity and set's some specific values in some of our custom fields. One of the fields that is being cloned is the a custom field that is a long text area but the script seems to error out everytime there is a record that has carriage returns in this field. Is there something special that needs to be done with long text are fields? I am simply using the following syntax to grab the value from the old record and then to set it in the cloned oppty:
to get the value:

var osnote = "{!SFDC_520_Quote__c.OS_NoteOld__c}";

and then to set it in the new oppty:

upd.set("OSNote__c",osnote );


thanks for any help!

I have seen a few threads on this before, but could not find any by searching.  I would suggest trying to grab the value through the API instead of a merge field... it might be a little slower, but I think it will work.
Store the ID of the record in a variable using a merge field, then use it to retrieve the OSNote field.  Then use the result to set the new record.
of course! thanks..this worked!
I'm glad it worked, because only hours after posting I got an error on an s-control I'm working on, and it was for the same exact issue!!  :smileyhappy:
I ran into this same issue a few projects ago. Even if you use the API to get the text-area field value, you must handle the case when the value contains special characters.
I simply constructed a regex expression to match for all special characters and then replace them with "". If you actually want the special character to be copied over, you can replace it by the character itself (e.i: "\n").