I have a vf page that displays queried results in a data table that works perfectly fine in my sandbox's force.com site. However, when I try to access it in production's force.com site it does not show the queried results at all only the column headers. I've ran debug logs and see the query being called but it retrieves no results.

It does show when Im accessing it in production not through the force.com site so I know there should be records returning. I've checked permissions for the force.com site profile and it has read access for all of the fields in the query.

Is there other reasons why I can't query the results? It doesn't make sense that it works in my sandbox but not in production even with the same permissions assigned to the force.com site user.

I don't think it is the profile's permission because I have another VF page that displays record details just fine.

  • What are the Organization-Wide Defaults and Sharing Rules on the object being queried? Is the class running with sharing or without sharing? – David Reed Jul 30 '18 at 1:51
  • With sharing. I considered changing it to without sharing, but why would it work in my sandbox but not production if its currently with sharing then? OWD is read/write – adming32442 Jul 30 '18 at 1:53
  • It's hard to think of what else it could be other other than permissions and OWD sharing. I suggest comparing the guest user permissions using the perm-comparator tool Also if the object OWD is private, who is the record owner in the sandbox vs. the owner in production? – David Cheng Jul 30 '18 at 3:07
  • 1
    The symptoms point to a sharing issue. Check object, owd, etc. if one user gets records and another doesn’t it is due to sharing. – Eric Jul 30 '18 at 3:14

Check the site security and ensure the the running user has proper permission to both the object and fields required.

Setup -> develop -> sites

Choose your site via the site label.

Click the public Access and modify the object permission.

Check both object and field level permission.

If this is properly set than the issue lies in sharing model.

| improve this answer | |
  • Yes this is all correct. It is the same in the sandbox and production. – adming32442 Jul 30 '18 at 2:03
  • What is the difference between the vf page with the query that works vs the one which fails? – Benjamin Pirih Jul 30 '18 at 2:07
  • There is no vf page that has a working query, the other vf page shows details(its a custom detail page) that is related to the same object that the vf page with the query is accessing. the query is trying to access shipment__c and so is the custom detail page. only the custom detail page shows information on a shipment record but the query does not return anything. – adming32442 Jul 30 '18 at 2:11
  • Please post the query. A screenshot of the object permission. A screenshot of of the field permission.. – Benjamin Pirih Jul 30 '18 at 2:23
  • Thank you for the suggestion and help Benjamin but I can't post that information because these are fields I do not want to share to the public. Also I have looked at the permission over and over and I really don't think that is the problem considering that it works in my sandbox's force.com site, it works in production, just not the force.com site production. – adming32442 Jul 30 '18 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.