Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
    
salesforce.stackexchange.com/questions/7494/… You may like to refer this link –  Mohith Shrivastava Feb 7 '13 at 7:21
    
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

2 Answers 2

You can accomplish this using the Filtered Lookup feature.

Defining Lookup Filters

share|improve this answer
    
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

http://blog.jeffdouglas.com/2011/08/12/roll-your-own-salesforce-lookup-popup-window/

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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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