I have a trigger that on save I want to add an error to my page, however if the user clicks save again I want it to let them. Is there a way to check to see if there was an error message on the page? Or is there another way around this?

Thanks in advance!

  • You could probably do it with a custom button to call a method through webservices to allow the error on the first run and catch it on the second run. Although I haven't done it myself so I don't know what issues you might ultimately run into.
    – martin
    Commented Aug 11, 2015 at 17:29
  • Its on the standard notes page so I can't make a custom button. The best thing I have so far is trying to see the URL through the trigger or a method I call from the trigger that then can check if there is an error based off of the' \e' at the end of the URL but I cant get that to work either Commented Aug 11, 2015 at 18:09

2 Answers 2


Basically, no. You can't do this with a trigger, because no memory is retained between each transaction on the server, except by "view state", which only occurs in Visualforce. You'll need to use Visualforce to get this kind of behavior. Also see this idea on using S-Controls and this idea for having standard confirmation dialogs for things you can vote on.


An alternative I've used that may be applicable to your use case is:

  1. Add a custom field 'Override_Validation_ErrorX__c` to the object and page layout
  2. When error is thrown, indicate in the error message that if "user knows what they are doing, they can override the error by checking the box".
  3. In the before update trigger, if the override_validation_errorX__c is true, then allow the update to pass --but before ending the trigger, set 'Override_Validation_ErrorX__c` to false.
  • Would this be possible on the Notes page though, since it's not customizable? Commented Aug 12, 2015 at 17:23
  • ah - Notes OOB standard object -- you are correct, this is not customizable - you could tell the user to enter the string "Override Error" or some such (e.g. "Continue") in the notes body and the principle would still work
    – cropredy
    Commented Aug 12, 2015 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .