Activity Forums Salesforce® Discussions What are the different types of messaging options in Visualforce page?

  • Mohit

    Member
    September 5, 2016 at 7:52 am

    Hi Pranav,

     

    The Different type of messaging option are:-

    1)Info:-

    It is code is Eg:-

    <apex:page >
    <apex:pageMessage summary="This is a pageMessage" severity="info" strength="3"/>
    </apex:page>

    2) Error  :-

    It is code is Eg From Standard Controller Message:-

    <apex:page >
    <apex:pageMessage summary="This is a pageMessage" severity="error" strength="1"/>
    </apex:page>

    Custom Controller Message:-

    <apex:page controller="TestMessageController">
    <apex:pageMessages />
    </apex:page>

    public class TestMessageController{
    public TestMessageController(){
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'This is apex:pageMessages'));
    }
    }

    3)Warning :-

    The code is:-

    <apex:page controller="WarningMessage">
    <apex:pagemessages />
    </apex:page>

    public class WarningMessage
    {
    public WarningMessage()
    {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.Warning, 'This is a warning message'));
    }
    }

    4)Confirm

    It is code is :-

    <apex:page controller="SuccessMessage">
    <apex:pagemessages />
    </apex:page>

    public class SuccessMessage
    {
    public SuccessMessage()
    {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.Confirm, 'This is a success message'));
    }
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos