I have a contact lookup so when i click on the lookup it opens a popup and i search for a particular contact. what i want is to restrict the result to display only contacts related to a account, for example in my case object i have account field i also have contact field when i click on the lookup of contact it should only show the contacts of the account. Do any body have any idea to do this. Please help me.


You can accomplish this using the Filtered Lookup feature.

Defining Lookup Filters

  • thanks that was nice but works only when we insert record through the object directly. Can you guide me how to do it through code. because i am trying to insert record from a VF page. – AnuRaj Feb 7 '13 at 7:46


If you are using visualforce page for this one workaround is to roll your own salesforce lookup popup window .

The above blog has tips and tricks on how to achieve this

  • is the filters only work on a standard page, if we are using the field as apex:inputfield wouldnt the filter work like in standard page – AnuRaj Feb 7 '13 at 8:21
  • Filters i personally have tried but with no luck.You can try though .Sometimes i used to get field "filter Validation Exception".let me also know if you are able to work for visualforce with filters – Mohith Shrivastava Feb 7 '13 at 8:23

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.