function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gowtham murugesangowtham murugesan 

custom validation error in trigger

Hi all,

T.adderror('<span><b>Enter Name in format</b></br><b>john smith</b></span>',false);


I used this error message for custom validation in trigger ..its working fine in classic but in lightning is not working ..."error is showing in same line"how to separate this into two line?
Khan AnasKhan Anas (Salesforce Developers) 
Hi Gowtham,

Greetings to you!

I tried to research your problem and found that this is a known issue. Keep watching this issue until get fixed.

https://success.salesforce.com/issues_view?id=a1p3A00000188igQAA&title=html-tags-in-the-error-message-are-escaped-even-if-escape-false-is-specified-at-sobject-adderror-on-lighting-ui

This limitation has been documented at https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm#apex_System_SObject_field_addError

escape
Type: Boolean
Indicates whether any HTML markup in the custom error message should be escaped (true) or not (false). This parameter is ignored in Lightning Experience and the Salesforce app and the HTML is always escaped. The escape parameter only applies in Salesforce Classic.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas