I have a visualforce page on a Force.com site that uses the Contact standard controller to create a new contact. I have a lookup field on the page which should pull a list of the location__c custom object. In the preview, the lookup field is working perfectly, however on the Force.com site the lookup dialog box opens and says this:

No records found

No records found due to one of the following: There are no records of this type You don't have permission to see any of the records Records do not fit the filter criteria set by your administrator

On the site detail page Search Pages and Lookup Page are both selected in the Site Standard Pages.

The profile has read and create access on the contact object and the location__c custom object.

Here is a simplified code of the VF page:

<apex:page standardController="Contact" extensions="NewContactControllerExtension" showHeader="false">
<apex:slds />
  <div class="slds-scope">
    <div style="padding-right:50px; padding-left:50px; ">
        <apex:form >
            <apex:pageBlock title="Add a New Contact">
                <apex:pageBlockSection columns="1">
                        <apex:inputField value="{!Contact.FirstName}"/>
                        <apex:inputField value="{!Contact.LastName}"/>
                        <apex:inputField value="{!Contact.Building__c }" required="true"/> <!--This is the lookup field -->
                <div style="margin:auto;">
                    <apex:commandButton action="{!saveAndRedirect}" value="Save"/>

This is the code for the controller extension (which just saves and redirects the page when user clicks save button):

public class NewContactControllerExtension {
private Apexpages.StandardController controller;
public NewContactControllerExtension(ApexPages.StandardController stdController) {
    this.controller = stdController;
public PageReference saveAndRedirect() {
  PageReference newPage = Page.ThankYou;
  return newPage;

} }

  • 1
    What you type in a known location into the search and click 'Go', does it appear? What is the external sharing model for buildings?
    – Nick C
    Jul 23, 2020 at 22:48
  • 1
    +1 Nick. Check the external sharing model, which may be hiding Location__c records by default as of Summer '20. See the details here Jul 23, 2020 at 23:32
  • Thank you! Added a sharing rule to the location__c and now it works! Now I can search for a known location and it shows up. Will check how I can make it populate automatically. Jul 24, 2020 at 4:52
  • @ShiraFreed Try using your comment above as an actual answer to your question. It's helpful for the community to see the answer, even if you answer it yourself Jul 24, 2020 at 4:58
  • @BrianMiller How can I make the list of available locations show automatically, without having to search for them? Users won't necessarily know what they should be searching for... Jul 24, 2020 at 5:45

1 Answer 1


Go to sharing settings and add a sharing rule to the object that is supposed to show up in the lookup field, in this case, location__c.

enter image description here

You must log in to answer this question.

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