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

  • Ratnakar

    Member
    March 20, 2018 at 11:04 am

    Hi,

    you can use following code:

    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter value'));

    severity is a enum which can have following values:

    • CONFIRM
    • ERROR
    • FATAL
    • INFO
    • WARNING

    I hope this helps you.

  • 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.

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos