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 set relationship field with icon on vf page

Best Answer chosen by Vempally
Sfdc CloudSfdc Cloud
Hi Sureh

You can use inputfield to map lookup field in vf page
<apex:page standardController="Contact">
<apex:inputField value="{!contact.account}"/>
</apex:page>

Hope this helps :)

All Answers

Sfdc CloudSfdc Cloud
Hi Sureh

You can use inputfield to map lookup field in vf page
<apex:page standardController="Contact">
<apex:inputField value="{!contact.account}"/>
</apex:page>

Hope this helps :)
This was selected as the best answer
vamshi(Nani)vamshi(Nani)
Yes the above one is correct code you can access with this code you relationship filed
VempallyVempally
Hi Nitin

how to achieve the same in custom controller....?
Sfdc CloudSfdc Cloud

Suppose you have an Employee Custom Object. In that lets say you have First Name Custom field.
Now you want the lookup icon to be displayed for the above field in your Visualforce page.

Controller

public Employee__c getExample()
{
   return [select FirstName__c from Employee__c limit 1];
}

Visualforce Page:
<apex:inputField value="{!Example.FirstName__c}"/>

if this answer helps,please mark it as best answer to help others:)
Thanks,