Activity Forums Salesforce® Discussions How to show field name error in VisualForce pages in Salesforce?

  • How to show field name error in VisualForce pages in Salesforce?

    Posted by Deepak on October 23, 2020 at 4:15 pm

    How to show field name error in VisualForce pages in Salesforce?

    Shweta replied 4 years ago 2 Members · 1 Reply
  • 1 Reply
  • Shweta

    Member
    October 27, 2020 at 3:21 pm

    Use the below code to show the error message:
    if (fieldname == null){
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter value'));
    return null;
    }
    Insert the below tag inside the visualforce page within page block
    <apex:pageMessages ></apex:pageMessages>

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos