Another Salesforce blog!!!

Salesforce, Apex

apexpage message utility

  public static PageReference showMessage(String message, String msgType) { 
        ApexPages.Message msg;
        if(msgType == 'Error') {
            msg = new ApexPages.Message(ApexPages.Severity.ERROR, message); //error
            msg = new ApexPages.Message(ApexPages.Severity.INFO, message); //info
        return null;

To use:

<apex:pageMessages ></apex:pageMessages>
showMessage('At least ' + count  + ' responses required', 'Error');

Leave a Reply

Your email address will not be published. Required fields are marked *