function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinu@dreamsSrinu@dreams 

If an unauthorized user try to edit and save the record a vf error should display in window, How?

Chamil MadusankaChamil Madusanka

If your edit and save action methods are in controller, you can wrap your code with try catch and catch the SecurityException. In catch block you can add a page message to display in VF page.

 

try
{
// your code here

}
catch(SecurityException ex)
{
   Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,''+' Access Denied'));
}

 http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_exception_methods.htm

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.