+ Start a Discussion
Patricia LimPatricia Lim 

How to create custom controller for master-detail relationship user input

I would like to populate the lookup icon for a master-detail field so that end-users can choose the parent object for a new child record.
How can I do this with a custom controller?
 
<apex:page standardController="Scholarship_Award__c">
    <h1>2020-2021 Academic Year</h1>
    <apex:form >
    <!-- Hi -->
    <apex:pageBlock title="Add Scholarship Awards">
        <apex:pageBlockSection columns="2">
            <apex:inputField value="{!Scholarship_Award__c.Name}"/>
            <apex:inputField value="{!Scholarship_Award__c.Year__c}"/>
            <apex:inputField value="{!Scholarship_Award__c.Recipient__c}"/>	
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
    </apex:form>
</apex:page>



Thanks, I am new to VF
AnudeepAnudeep (Salesforce Developers) 
Hi Patricia - I recommend looking at the sample code posted here

If you find this information helpful, please mark this answer as Best

Thanks, 
Anudeep