I was working on the same thing, and found that the \r did actually work, but in the regular UI, it did not wrap the text, but when I opened the field for edit, the carriage return was there and it did in fact work.
so:
Object.Long_Text_Field__c = 'xyz' + '\r' + 'abc'
Showed in the detail page as:
xyzabc
but when I edit the record or the individual field it shows as:
The way to get it to show in the UI correctly is to use the html line break: <br>
so:
Object.Long_Text_Field__c = 'xyz' + '<br>' + 'abc'
Showed in the detail page as:
xyz
abc
AND when I edit the record or the individual field it shows as:
xyz
abc
This should resolve your issue all together.
All Answers
I was working on the same thing, and found that the \r did actually work, but in the regular UI, it did not wrap the text, but when I opened the field for edit, the carriage return was there and it did in fact work.
so:
Object.Long_Text_Field__c = 'xyz' + '\r' + 'abc'
Showed in the detail page as:
xyzabc
but when I edit the record or the individual field it shows as:
xyz
abc
Thanks....
I wonder if there is a way to make it the way it looks in standard salesforce.
The way to get it to show in the UI correctly is to use the html line break: <br>
so:
Object.Long_Text_Field__c = 'xyz' + '<br>' + 'abc'
Showed in the detail page as:
xyz
abc
AND when I edit the record or the individual field it shows as:
xyz
abc
This should resolve your issue all together.
Yes indeed it would. Let me try it...thanks.