+ Start a Discussion
Sten EbenauSten Ebenau 

addError() always escapes html content in SF1 and Lightning

Hi Everyone,

the addError() method which you can use in an Apex Trigger alsways escapes the error message when used in SF1 or Lightning. Has anyone experienced the same and has a solution or should we contact Salesforce with a bug report?

Thanks,

Sten  

 

Tejpal KumawatTejpal Kumawat
Hello Sten,

addError() message always escapes html content in browser, sf1, lightining etc. But if you use normal text it works fine.

If this answers your question mark Best Answer it as solution and then hit Like!
Sten EbenauSten Ebenau
Hi Tejpal,

That is not correct. In the classic ui you can escape html content by doing addError('<a href="">Hi</a>', false); this will display the link in the error message. With SF1 & Lightning the message is always escaped.

 
Tejpal KumawatTejpal Kumawat
Hello Sten,

Right, this is an issue in SF1 & lightning. You need to log a bug.

If this answers your question mark Best Answer it as solution and then hit Like!
ShashankShashank (Salesforce Developers) 
Hi,

Please note that the addError() method was never meant to render HTML, and hence it is expected behavior to escape HTML markup.

Please see the documentation here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm#apex_System_SObject_addError

Thanks,
Shashank Srivatsavaya
Salesforce.com
Sten EbenauSten Ebenau
Hi Shashank,

Why is there an option to specify if you would like to not esacpe the error message? Also new line charachters are esacped as well. That is not HTML. 

There is clearly different behaviour between SF1/Lightning and Classic. 


 
ShashankShashank (Salesforce Developers) 
I checked internally and looks like R&D has identified this and are working on a fix. The current ETA is set to the next Summer '16 release. Please let me know if you have any questions.
MG ConsultingMG Consulting
Hi Shashank,

Would you please create a known issue (https://success.salesforce.com/issues_index) for this?

Thanks a lot,
Mike
Raja Bhandari 16Raja Bhandari 16
Hi, Is this now woring in lighting interface ?