+ Start a Discussion
peterk900peterk900 

Filtering a Look up field selecting contacts

I have a custom object which has several fields which need to be populated with contacts. 
I have created a look up relationships for each  where the related to field is Contact.

How can I:

(a) filter the list displayed in the look up box so that only contacts for a particular account are shown

(b) filter the list displayed based on a custom field added to Contacts ?

 

I've tried to use the filter options when the field is created but it does not seem to have the options I want ?  Am I missing something ?  Can I do this by this method or do I have to create a page from scratch in code if I want to do things like this ?

 

Thanks

 

Peter





 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
peterk901peterk901

Thanks for coming back. 

Yes I have tried filters.

 

The object  is called ChurchEvent and the field in question is Undertaker.  The idea is that the person entering he details of the funeral can only select those contacts who are marked as Undertaking Firms.  Hence the need for a filter.

 

The  custom field  Undertaker  is supposed to get all the contacts  with the Undertaker field set to true and display them in the dropdown box.

 

So the filter instructions I want to give is : 

 

Field: Contact:Undertaker  

Operator: Equals 

Value: Value

Field: True    

 

The problem is with the first entry   Field: Contact:Undertaker.   I don't see any contact fields in the selection box - I get get fields related to this object or current user.  If I try and type in contact:undertaker it gives an error.

[Sorry the data items are of a morbid nature !]

 

What I fear is that filters only work with current user data and fields on the object itself.

 

Thanks

 

Peter

 

 

All Answers

Baktash H.Baktash H.

did you try related lookup filter?

 

go to setup -> Create -> objects -> yourObject -> theField -> Click Edit.

On the bottom you see "Lookup Filter". There you can add filters.

peterk901peterk901

Thanks for coming back. 

Yes I have tried filters.

 

The object  is called ChurchEvent and the field in question is Undertaker.  The idea is that the person entering he details of the funeral can only select those contacts who are marked as Undertaking Firms.  Hence the need for a filter.

 

The  custom field  Undertaker  is supposed to get all the contacts  with the Undertaker field set to true and display them in the dropdown box.

 

So the filter instructions I want to give is : 

 

Field: Contact:Undertaker  

Operator: Equals 

Value: Value

Field: True    

 

The problem is with the first entry   Field: Contact:Undertaker.   I don't see any contact fields in the selection box - I get get fields related to this object or current user.  If I try and type in contact:undertaker it gives an error.

[Sorry the data items are of a morbid nature !]

 

What I fear is that filters only work with current user data and fields on the object itself.

 

Thanks

 

Peter

 

 

This was selected as the best answer
peterk900peterk900

I've solved the problem -  I think I may have been confused as to how it works.

 

What I want to do is solved and the filter criteria shows  

 

 Undertaker:Undertaker EQUALS True 

Related to  :  Contact

 

So I wanted to see   Contact:Undertaker EQUALS True which to me seemed logical -  make the Undertaker field on the contact record = True.

 

But actually SF shows  Undertaker:Undertaker  not Contact:Undertaker.

 

Thanks

 

Peter