I have a trigger in which error message is getting displayed in a standrad page using adderror method.Which gives an error

Error: Invalid Data. Review all error messages below to correct your data.

I want to disable this message and only need to display my customize message.

Is it possible?

  • Are you still experiencing this error? Aug 22, 2014 at 14:06
  • @DavinC yes!I kept as it is and added my error message below it. Aug 22, 2014 at 14:37
  • Add your changes to your post and hopefully we can get it resolved for you. Aug 22, 2014 at 14:39

3 Answers 3


Try this

for(Session__c sNew : trigger.new)
   sNew.addError('Overlap Session');

  • Adding some explanation as to why this works differently, would really increase the value of your answer Anu. Jun 23, 2014 at 13:14
  • Thanks Anu.It will give -Error: Invalid Data. Review all error messages below to correct your data.Overlap Session.But this is not the answer to my question. Jun 23, 2014 at 15:43

Use a try/catch block around your DML:

  upsert someObj;
} catch (Exception e)
  ApexPages.addMessage(new ApexPages.Message('some custom message', WARNING);

The Syntax isn't 100% correct, but I believe it's somewhat close. If you are already posting messages to your page you should already know what to do.


This is a very simple solution to my question :)

if ( some condition) { String errStr ='Error message'; ac.addError(errStr); }

You must log in to answer this question.

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