We created a field of type "Formula" with Formula Return Type "Text" and the Advanced Formula (using the BR function):
'Line1' + BR() + 'Line2' + BR() + 'Line3'
This field was included in Compact Layout and in Page Layout.
The field is sometimes (randomly (!)) displayed correctly (3 lines with line breaks, also see the first screenshot)
Line1
Line2
Line3
and sometimes as HTML markup (also see the second screenshot):
Line1<br>Line2<br>Line3
The same happens using the IMAGE function or any other function generating HTML markup.
In case of correct display, the HTML source for this snippet is
<p class="slds-text-body--regular slds-truncate" data-aura-rendered-by="307:719;a">
<span data-aura-rendered-by="298:719;a">
Line1<br data-aura-rendered-by="300:719;a">Line2<br data-aura-rendered-by="300:719;a">Line3
</span>
</p>
In case of incorrect display, the HTML source is
<p class="slds-text-body--regular slds-truncate" data-aura-rendered-by="307:719;a">
<span data-aura-rendered-by="298:719;a" class="uiOutputText" data-aura-class="uiOutputText">
Line1<br>Line2<br>Line3
</span>
</p>
- We're using a sandbox with the Winter'18 release
- the same happens in the production environment and
- both in Lightning Experience and Salesforce classic
- in all browsers
Is this a known problem? How can this be fixed?
Best Answer
It looks like this issue still comes up every now and then in random places.
For anybody looking for a workaround, you can create a Custom Label (say
New_Line
) and use it in the concerned formulas.The value of this custom label should be as follows.
The label needs to have the dummy starting end ending characters (that is,
<
and>
) because all leading and trailing whitespace gets removed.This custom label can then be used in a formula field as follows.