I have a Visualforce page that displays a parent object and a list of related child objects. The page works when run inside Salesforce; the parent object info and list of child objects are visible. When the page is public/external access, the child objects do not appear. I want the child objects to be visible internally and externally.
The parent object has default external access of "Private". There are numerous sharing rules for the parent object. The relevant one for us is that if the visibility is set to "Public", then the record is shared with group "Tracker Public Site User". The child records have default external access of "Public Read Only". The profile for the group, "Tracker Profile", has Read permission for both the parent and child object.
The field visibility for the fields in the SOQL query is at least "Read Only" - with one possible exception. One formula field on the child record (see formula below) references a field it does not have access to, Filer_Ct__r.Full_Name__c, a field on the contact record. The SOQL query does not use WITH_SECURITY_ENFORCED.
Also, some of the fields in the SOQL query are part of a field set, but the field set appears to be used only as a means of querying for the fields needed in the query. The field set is not referenced in the Visualforce page.
The Apex class for the page has the "with sharing" keywords.
What is the behavior of a formula field that is part of a SOQL query? Does the running user/site user need to have access to all fields referenced in the formula? Or is access to the formula field enough?
What is the behavior of a SOQL query when some of the fields are not accessible to the query? Does the query fail or do the missing fields get a blank or null value?