You need to sign in to do that
Don't have an account?
Uves Ravat
Error Message
Hi.
If anyone can help me that would be great. I want a error message appear on the screen to say project is locked if a variable is true. Below
public void updatingProjectProposalHeader()
{
SObject ErrorMessage;
if (m_ProposalLocked)
{
// if its true, i want it to display on the screen that project it locked.
}
}
if have tried the following code, the error message is very ugly.
public void updatingProjectProposalHeader() { if (m_ProposalLocked) { throw new lockProposalException ('Proposal Locked'); } } public class lockProposalException extends Exception{}
Thanks
You should probably be using addError instead:
(proposalRecord should be the record obtained from the page's standard controller or member variable).
When this occurs in a Visualforce page, the error will appear in your page's apex:pagemessages block. If you do this through a trigger, it will appear on the standard page's error header, or as an error message on an API call.
Hi,
I am bit confused on where i get proposalRecord value from
Thanks
Uves
ProposalRecord is an SObject that is bound to the page. I presumed you had a Visualforce page, in which case it'd look like this:
The controller looks like this: