4

I believe it's a known issue, but I was wondering if there is still no work around this.

In my trigger, sobject.addError always escape my html tags even if I set escape to false. This is really annoying. I would love to make the error message a bit more friendly when a user try to delete an event.

trigger EventTrigger on Event (before delete) {
    for (Event item : Trigger.old){
        if(item.EndDateTime < System.now() || item.ActivityDate < System.now()){
            item.addError('<span color="red"><b>YOU CANNOT DELETE THIS EVENT</b></span>',false);
            return;
        }
    }
}
  • It used to work though in one of the last 2 releases I think Salesforce stopped supporting HTML in this cases. Trying to find the documentation... – Boris Bachovski Jun 26 '14 at 23:23
  • 3
    Salesforce is becoming very particular about UI. Plus, it doesn't make sense from other perspectives, like API responses, especially SOAP. I think they're trying to avoid special use case scenarios, for performance reasons. – sfdcfox Jun 26 '14 at 23:27
  • 2
  • They should make at least the delete page a bit more friendly then. I had to override the delete button just to have a nice message. – Cloud Ninja Jun 26 '14 at 23:34
  • I see the fix is now set for release in Winter 15 – crmprogdev Sep 13 '14 at 15:09
1

This is fixed now. You can set escape to false for delete triggers now. But they applied a condition here that this would only work in classic, not in lightning, not in salesforce1. Other than classic String would always be escaped.

I wrote an answer here which you can read as well for the same.

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.