addError() with escape=FALSE is escaped at a lead conversion
Trailblazer Community

addError() with escape=FALSE is escaped at a lead conversion

Apex , Winter 16

Last updated 2018-03-29 ·Reference W-2812314 ·Reported By 63 users

No Fix

addError() method escapes HTML even if escaped optional var = FALSE when trying to convert a lead.

1. Create a trigger on Account, which calls the addError() method with escape=FALSE to Account entities.

trigger AddErrorTrigger on Account(before insert) {
for(Account acc : Trigger.New){
acc.addError('an html error with a <a href="">link</a>', FALSE);

2. Create a new Lead.

3. Open the Lead through UI, which has been created at the step 2.

4. Click "Convert".

5. Select "Create New Account" for "Account Name".

6. Fill the required fields, and click "Convert".

7. You will see the following validation error:

Error: Validation error on Account: an html error with a <a href="">link</a>


Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.