+ Start a Discussion

Apex messages question

When should I use apex:message vs apex:messages vs  apex:pageMessage and apex:pageMessages? I read the docs but its very confusing

Venkat PolisettiVenkat Polisetti

<apex:messages/> and <apex:pageMessages/> are the same for all practical purposes except that the <apex:pageMessages> are shown with SF default styling and you cannot style them. <apex:Messages> can be styled to your liking using your own styles.


The same info applies to <apex:message> and  <apex:pagemessage>.


Here is an example of <apex:pageMessage>:



<apex:pageMessage summary="This Opportunity is currently synced with any Quote." severity="warning" strength="3" rendered="{!isNotSyncing}" />
Thanks for clarifying- very helpful. Question I have is what than is the diff between apex:message vs apex: messges and apex:PageMessage vs apex:pageMessages?

when i clicked the link it says the page doesn';t exist


Okay its something like this:


apex:PageMessages is a containing component where any messages that have been added to the page will appear.


apex:pageMessage is a component that adds a single message to the page.