+ Start a Discussion
Sea TigerSea Tiger 

Contact Lookup with filter s-control

We are working in SalesForce Team Additon and are finding the Lookup Field lookup function to be frustrating. There are no filters available and with thousands of contacts, it is impractical.

My quest is to find s-control code that will allow us to establish a predefined filter based on the current account to provide a list of contacts from which the user can select.

Can anyone help me?

Regards,
Jim
qvisionqvision
Hi Jim,

did u ever get a help on this one? Or did u resolve this manually? I agree a filtered lookup is a very important feature I am looking for as well...

Regards,
Matt P.ax296Matt P.ax296
I agree.  I have a few clients that would significantly benefit from this functionality.  Does anyone have solutions, workarounds or hacks for this problem?

Thanks
-Matt
KevinHoelzelKevinHoelzel
I feel like I'm getting close to a solution to this issue of non-context sensitive lookups.  Essentially, when a user is creating a support case for a customer and the Account is already selected, clicking the lookup for Contact should display all contacts for that specific customer and only for that customer.  I took a look at how the lookup window is called. 
 
Code:
openLookup('/_ui/common/data/LookupPage—lkfm=editPage&lknm=cas3&lktp=' + document.getElementById('cas3_lktp').value,670,document.getElementById('cas3_mod').value,'&lksrch=' + escapeUTF(document.getElementById('cas3').value))

If there is some way of adding a parameter to the LookupPage, like Account.ID or Contact.AccountID, then this could be accomplished using an S-Control.  I've also thought of taking the lookup page code and creating an S-Control out of it with the parameters I want to pass to it for lookup filtering, known as "Context Sensitive Lookups". 

Please expand on this with  your knowledge


go_jobing!go_jobing!
Did you ever finf a solution to this, I'm having an issue very like this with lookup limitations...
go_jobing!go_jobing!
Did you ever find a solution to this, I'm having an issue very like this with lookup limitations...
pvollrathpvollrath
This seems to be a pretty basic function that the application is missing.  I, too, would like to see a lookup field filter solution.
fifedogfifedog
Hey guys,
I think you maybe missing something which will help out.  To my understanding you're wanting the case to find contacts to which match the account you've listed on the case?  Is that correct?

Did you know if you just search for the contact first it will put the correct account on the case?  If you do not deal with vendors who give support as teir one support then you may want to make the account field read only on the page layout. 

I know it's not the solution you're looking for but it does save you a step. However there is an idea listed on IdeasExchange which is what you're looking for: http://ideas.salesforce.com/article/show/25164/Filter_on_Lookup


Message Edited by fifedog on 01-04-2008 02:35 PM
pvollrathpvollrath
The idea here, at least from my perspective, is that I'd like the list of possible contacts to select from in a lookup field to be able to be limited by a rule.  For instance, on the contact screen I may want a "contact reference source" lookup field, where you can select only contacts affiliated with my organization and a few others to appear (as the person who referred the contact).  I don't want the user to be able to select just any contact in our system, and I definitely don't want the thousands of contacts in the system to show up.  I don't believe your solution addresses this problem.

FYI: it looks like this is a big issue in general with sfdc already, see: http://ideas.salesforce.com/article/show/25164/Filter_on_Lookup to help promote this issue.
MakMak
Even I am facing the same problem. SO I have created a Visualforce page which pops up on click of look up image.
I pass the value user entered and the type of lookup (as I am using the same page for multiple lookups on different objects) as query parameters.
When the user clicks on any value in the search popu, that value is transferred in its proper field on the main page.
Just take care while saving the record, as you have to validate if user typed some garabage in the input text.

Here's the code for main window:

main page -

<apex:inputText id="employee" value="{!contactName.Name}" rendered="{!userDetails.Expense_Admin__c}"/>  
         <apex:image url="{!$Resource.LookupImage}" onclick="openlookup()" style="cursor:pointer" rendered="{!userDetails.Expense_Admin__c}" id="employeeLookup"></apex:image>

JS -

function openlookup(){
            var employee = document.getElementById(tmpDetailID + ':employee');
            var URL =  '/apex/ExpenseReportLookup?type=employee&value=' + employee.value;
            newwindow=window.open(URL,'Employee','height=400,width=600,scrollbars=1');
            if (window.focus) {newwindow.focus()}
       
        } 

Hope this helps. Though I would  love it if this was offered Bt lookup control.

prbprb
If you come across this message please promote this idea:
http://ideas.salesforce.com/article/show/25164/Filter_on_Lookup


FatimaFatima

Hi dear,

have a look at www.sarwari.org

Easy lookup filter between lookup relationships.

No matter if standard or custom fields.

cheers