Another Salesforce blog!!!

Salesforce, Apex

ApexPages.addMessages


Here are some examples of how to add messages with different severities and how they are outputted:

VFP:

<apex:pageMessages />

APEX Controller:

Confirm/Success:

ApexPages.addMessage(
     new ApexPages.Message(ApexPages.Severity.Confirm,'Sample Success Message'));

Warning:

ApexPages.addMessage(
    new ApexPages.Message(ApexPages.Severity.Warning,'Sample Warning Message'));

Informational:

ApexPages.addMessage(
    new ApexPages.Message(ApexPages.Severity.Info,'Sample Informational Message'));

Error:

ApexPages.addMessage(
    new ApexPages.Message(ApexPages.Severity.Error,'Sample Error Message'));

Leave a Reply

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

*