function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VempallyVempally 

How to get a lookup field on vf page with icon using custom controller...

Best Answer chosen by Vempally
Abhinav GuptaAbhinav Gupta
You need to use Child object in apex:inputField tag to get a look up field for parent. For ex. if you want to create a look up Account record, one way could be using child Contact record. Please refer code snippet below:

<apex:page standardController="Contact">

   <apex:form>
     <apex:inputField value="{!Contact.Account}" />
  </apex:form>

</apex:page>


All Answers

Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)
hi,

You can use <apex:inputfiled> to bind fields with datatypes with which they have been created.
You will get more information on http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inputField.htm

If this helps mark this as best answer.

Thanks,
N.J
Abhinav GuptaAbhinav Gupta
You need to use Child object in apex:inputField tag to get a look up field for parent. For ex. if you want to create a look up Account record, one way could be using child Contact record. Please refer code snippet below:

<apex:page standardController="Contact">

   <apex:form>
     <apex:inputField value="{!Contact.Account}" />
  </apex:form>

</apex:page>


This was selected as the best answer