Activity Forums Salesforce® Discussions How to add error on a Salesforce visualforce page through apex class and through the visualforce page? Reply To: How to add error on a Salesforce visualforce page through apex class and through the visualforce page?

  • PRANAV

    Member
    March 20, 2018 at 11:59 am

    Hi,

    You can add error on a visualforce page through the mention below error messages.

    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,’Please enter some value’));
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,’Please enter some value’));
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,’Please enter some value’));
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,’Please enter some value’));
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,’Please enter some value’));
    Hope this helps you more.