How to show a hyperlink in error message in lightning?

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.


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.
public Void addError(String errorMsg, Boolean escape)

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

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 :

Source : Link , Question Author : manoj , Answer Author : Kris Goncalves

Leave a Comment