[SalesForce] Lookup field not populating on Visualforce page

I have a custom visualforce page and controller and am attempting to populate a lookup field on that page. Often the lookup will contain a value already, and I would like for the value to . According to the documentation here, I should just be able to use <apex:inputField value="{!contact.custom_reference__r.Name}"/>. However, I seem to be missing something. With the following controller and page, the debug prints all show up correctly but the values on the visualforce page show up empty. Why would this be?

Here is the custom controller; all of the debug prints output the expected values:

public with sharing class StudentPortal_ProfileController 
{
    public Contact profileInfo {get;set;}

    public StudentPortal_ProfileController() 
    {
        Id userId = UserInfo.getUserId();
        List<User> UserList = [select U.ContactId from User U where Id =: userId];
        Id contactId = UserList.get(0).ContactId;
        Contact profileInfo = [SELECT Id, FirstName, Profile_Home_Institution__c, Profile_Home_Institution__r.Id, Profile_Home_Institution__r.Name FROM Contact WHERE Id =: contactId LIMIT 1];


        system.debug(profileInfo.Profile_Home_Institution__r.Id);
        system.debug(profileInfo.Profile_Home_Institution__c);
    }

}

Here is the VF page, which doesn't render anything for the <apex:inputField>:

<apex:page docType="html-5.0" controller="StudentPortal_ProfileController" extensions="AutoCompleteController" action="{!forwardToCustomAuthPage}" showHeader="false" sidebar="false" standardStylesheets="false">
<apex:form styleclass="form-horizontal col-lg-12 col-md-12 col-sm-12 col-xs-12">
    <fieldset>
        <apex:inputField value="{!profileInfo.Profile_Home_Institution__c}"/>
    </fieldset>
</apex:form>
</apex:page>

Even adding just <h1>{!profileInfo.Profile_Home_Institution__r.Name}</h1> to the page renders nothing. Why would this be?

Best Answer

I found the answer to my own question. @Mugambo put me on the right track with checking Organization-Wide Defaults. I was using a standard profile, which did not have CRUD access to my custom object (the child end of the lookup relationship.) I cloned the standard profile and added the CRUD permissions to the new profile. Everything works now.

Related Topic