I wrote a trigger a trigger on Lead object for a validation. If validation is failed, I'm showing a link in error.

l.addError('A Lead is already exist with the given email id. Refer : '+link,false); It is working fine in classic, but not working in Lightning. enter image description here

Please help me to achieve this.


1 Answer 1


The feature is not yet available in Lightning experience. the documentation says : addError(errorMsg, escape) Marks a trigger record with a custom error message, specifies whether or not the error message should be escaped, and prevents any DML operation from occurring. Signature public Void addError(String errorMsg, Boolean escape)

Parameters errorMsg Type: String The error message to mark the record with.

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.

reference : https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .