This is my VF Page.

<apex:page standardController="Account">

<apex:form >

<apex:pageBlock title="{!account.Name}" >

<apex:pageblockSection >

<apex:inputField value="{!account.Account_Number__c}"/>
<apex:inputField value="{!account.CustomerPriority__c}"/>
<apex:inputField value="{!account.Active__c}"/>
<apex:inputField value="{!account.SLA__c}"/>
<apex:inputField value="{!account.Billing_Contact__c}"/>
<apex:inputField value="{!account.Business_Contact__c}"/>


<apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>




My problem statement is when I invoke the "lookup" I can see it is showing all contacts regardless whether the contact is associated to the account or not.

enter image description here

I would like to display only those contacts belonging to that particular account.

Can someone point me some resources or provide me some highlevel guidelines as to how to achieve that ?

  • 1
    Does it have to be a lookup? You could query and create a list of Contacts at the Account in the controller/extension then display as a picklist on your VF page.
    – Girbot
    Oct 23 '14 at 16:23
  • Yes that would suffice :)..All I need is a way to show the list of all Contacts under that particular account.
    – Varun
    Oct 23 '14 at 16:29
  • 1
    Are you using the same lookup field billing contact on account layout too? One easy way is to use lookup fileter and display on the contacts related to the account. This will restrict the contacts related to the account both on the VF Page and the account layout.If this not a problem easy way is to use lookup filters
    – Rao
    Oct 23 '14 at 16:34

Try to use lookup filter. For more details refer to following link:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.