You need to sign in to do that
Don't have an account?
Insufficient privileges on "null" pagereference return
I've been having this issue for a while and just cannot seem to find what the problem is. Thought it started a few API versions back, there is a post that says update from api 18 to 19. Right now my controller and VF page are api version 20.
It doesnt happen on page load. Rather seems to only happen after a controller function has been called. Before this function completes it tasks it runs some checks. If any of the checks fail it is an error and I set a Boolean to true and a String to the error message and then return null. I use the public Boolean to know whether or not to show the error page message, and the public string is holding the message. I've checked the field permissions on each field that is being used and they are visible but read-only. Which should be fine as I am only using them to compare.
Any thoughts?
Can you provide some of the code?
This is my controller. Appologies for some of the formatting. The error always occurs when trying to return null when "showError = true".
The VF page:
This example can reproduce the error:
1) Create a custom object called Visible_Only_To_Admins__c and only allow admins to see the page.
2) Create this Page
3) Controller
4) Open the page as a non-admin and then click go. You will get the Insufficient privilege error.
This is because all of the instance variables ("admins" in this example) are saved to the View State.
The current user must have "read" access to all objects in the View State.
If the current user does not have "read" access to an instance variable, then the "Insufficent privilege" message will be shown.
I believe you are probably hitting this situation.
I recently ran across this problem and found the problem to be a class that I was instantiating in the page controller. The page and controller were at API version 27, while the class file was at version 20.0.
Updating the class version to 27.0 fixed the "Insufficient privileges" problem.
Hope that helps others with the same problem.
- Ron