+ Start a Discussion
Proposal ButtonProposal Button 

trying to display warning message Error: Compile Error: unexpected token: ')'

Hi All


I am trying to display a warning message in the custom VF page. Here is the thing i mentioned in the controller


 ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.FATAL, sendtomagnys.getMessage());


This is the error it is throwing


Error: Compile Error: unexpected token: ')'

Can you please help me out why it is throwing me the error. I mentioned this in middle of my apex controller....




1. Write the line given below in the VF page :

<apex:messages />


2. Write the lines given below in the controller :

ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity, summary); // For Standard error message

ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL, 'my error msg'); // For Custom error message



Hope this helps.

Devendra NataniDevendra Natani

1. Please Add the line given below in the VF page :

<apex:pageMessages />


2. Use the below code in controller of VF page:

ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.FATAL,'My Error Message'));


Please let me know if there is any issue.