You need to sign in to do that
Don't have an account?
DJP1S
Retain Formatting when copying Long Text Area to Rich Text Area
I've got a field that is long text that I would like to copy over to rich text in a trigger. The text gets brought over just fine, but it loses any carriage returns. If I make the Rich Text Field a Long Text Field, I easily keep the formatting by assigning
ObjectA.FieldA = ObjectB.FieldB;
Here's what I get now...
Long text field:
Blah Blah Blah
Neat Neat Neat
Oh So Cool
Rich Text Field:
Blah Blah BlahNeat Neat NeatOh So Cool
How can I keep my carriage returns? I would rather not have to change the field types, that is a last-ditch effort.
Oops, thats not so cool.
You need to replace carriage returns with br's as rich text area accepts HTML instead of string. So it doesn't identify \n or new lines.
try something like this:
All Answers
Oops, thats not so cool.
You need to replace carriage returns with br's as rich text area accepts HTML instead of string. So it doesn't identify \n or new lines.
try something like this:
Thanks! I added '' to <br/> and it works fine.