Could you please advise How to render html in addError method?

I am trying to display a html link in an error message that gets triggered up on insert. The problem is that the entire html shows up along with the error message as a label.

Could you please advise How to render html in addError method?


Try using the method: addError(String errorMsg, Boolean escape) and pass in the 2nd parameter as false to have the HTML rendered.

For example:

addError('<p>An Error has occurred</p>', false);
|improve this answer|||||
  • Hi, already tried – Dylan D Nov 11 '15 at 15:24
  • Hi, I've tried already the second parameter but still the HTML is not rendered. Also checked the entire implemetation of the addError method in the following link developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… – Dylan D Nov 11 '15 at 15:49
  • Is the addError being called by an Apex class through the trigger or is it called directly from the trigger? There seems to be a bug with it being called from a class link, but from a trigger should be working as of winter 15.link – Will.T Nov 11 '15 at 15:59
  • Is there anything else you can advise me to try becasue I still can't find a way to render the HTML? – Dylan D Nov 11 '15 at 16:06
  • It is called by an Apex class. – Dylan D Nov 11 '15 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.