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.

Is it possible to filter out only contact related to an account in a case object. When a case is created from account, it has the account field in case populated with the account name/Id. I want to select contact and the lookup should only show contacts related to this account. Is this possible?

Thanks

Update: Screenshot of what i have, i also tried the other way around, Contact Name:Account Name : AccountId equals Case:account Name: ID. In both cases i cant find the contacts which are related to the account set in the account. if i click show all results and then search i do get the contacts but its not when the filter is on. enter image description here

share|improve this question
    
Are you using a Visual Force page or the standard Salesforce form? –  Lex Jan 22 '13 at 8:49
    
using a VF page –  Prady Jan 22 '13 at 11:31
1  
In that case take a look at this post: blog.jeffdouglas.com/2011/08/12/… it describes how you can override the 'regular' lookup. I've used this in a system I'm working on and it's really great. Especially if you also use jQuery to autocomplete your contact input field. –  Lex Jan 22 '13 at 11:34

2 Answers 2

enter image description here

The lookup filter can be set to achieve this requirement

share|improve this answer
    
I am not able to get it working.. updated the question with the screenshot of what i got –  Prady Jan 23 '13 at 6:11
    
@Prady The question was tagged with admin so had not thought of using visualforce .This answer was for out of box .For visualforce may be you may need what Lex is suggesting.Thanks for heads up –  Mohith Shrivastava Jan 23 '13 at 7:05
    
i really didnt want to implement a own lookup Vf page unless very necessary. If filter could do it i am happy.. But some how filter doesnt seem to work –  Prady Jan 23 '13 at 10:55

As I already posted in my comment; take a look at this article. It gives you a way to implement your own lookup page. It basically consist of overwriting the JS that opens the popup and implementing your own visualforce page for the lookup. In our project I've combined this with the jQuery Autocomplete plugin that gives you possible options if you start typing in the field.

If you have more technical problems, leave a comment and I can give some more details.

share|improve this answer
    
Thanks @Lex, i was thinking on having a custom lookup Vf page if its really necessary. If a out of box solution could do it i would prefer it. If nothing works then custom Vf page :) –  Prady Jan 23 '13 at 10:55
    
Actually, if you use an apex:inputField on your VF page, it will also be subject to the lookup filter, so Mohith's answer could still be possible. In the screenshot you posted everything seems to be ok. What problems are you experiencing? –  Lex Jan 23 '13 at 10:59
    
its not showing contacts associated with the account selected. If i remove the filter out i can view the contacts associated. Would filter work on a new record? i am selecting account first then selecting contact. –  Prady Jan 23 '13 at 16:28

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.