+ Start a Discussion

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.


// your code here

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



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.