On a public site with guest user license, the Contact object details are returning null in simple SOQL statements. This is despite adding read or edit access to the site profile for the Contact object.

Why would this be happening? Does it have anything to do with ownership?

I have no problem with my own custom objects when I follow the right steps like here: Why does my SObject Checkbox field always return false in a VisualForce Page on a public site?

Only when I query a standard object like Contact.

  • You should edit your question and add some code to let people know on if there are any obvious issues. Have you tried giving a without sharing keyword to your apex controller, if it is a standard controller try adding an extension in without sharing mode.
    – Raul
    Commented Jan 23, 2018 at 8:45
  • you're welcome, happy coding! :)
    – Raul
    Commented Jan 23, 2018 at 9:13

2 Answers 2


Such problem usually happen when you run the page in User mode for Sites.

To have a proper access, try running your Apex controller in System mode by specifying without sharing keyword.


The issue was "with sharing" added to the apex extension controller. I replaced it with "without sharing" and it worked.

Credit to @RahulSharma for pointing out the not so obvious issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .