Custom Lookups in Salesforce.com

One of the consistent complaints I get by my clients when setting up salesforce.com is the weakness of the standard salesforce.com lookups.

A lookup is how one record in salesforce is "connected" to another. For example, a contact record has a lookup field to the account - the Account Name field. When creating a record, like a contact record, you need to find the correct Account Name, and to do so, you need to use the Account lookup function. That is called using the little magnifying glass to the right of the field.

This works fairly well when you want to search the entire Salesforce database for a certain record, like in the above example, when creating a new contact record from scratch. It is okay in other circumstances too, like when you know the name of the record you want. But these strengths become limitations in other circumstances.



As you can tell from the screenshot above, you have to type in a search term. This can be a drag, especially if you don't know the exact name of the account you're looking for. Even using the wildcard frequently leaves you empty handed. You actually have to leave the page, go find the record you need, then return to the lookup to enter it in.

There are many circumstances when you want the system to provide a "likely" list of records to the user so that they can choose from the ones offerred. Salesforce provides some mechanisms to limit the records returned in the lookup search (custom lookup filters), but these still require the user to know the record that they want to find.

To address this problem, we have developed many solutions over the years to replace the standard lookup functions with custom lookups. These can come in very handy in all kinds of situations: looking up products against opportunities, finding the correct signatory on a contract, finding the right contact for a case. Every solution ends up being unique based on the objects involved and the business model, but there are some common characteristics.

In a recent project, there was an Agreement custom object which had a contact lookup. The agreement record was associated with an Account already and the user would use the standard contact lookup to find a contact and populate a field called "Primary Contact."

We improved on the standard salesforce lookup by adding a new button just above the Primary Contact field.




That button calls a visualforce page (written in apex) that shows the user all the contacts at the account associated with that agreement record. It also gives them the functionality to change the account if needed or create a new contact. In the event there were many contacts at the selected account, we also included a filter whereby the user could type in a search term - our system would filter the list of contacts by seeing if the first name, last name, or title contained that search term.

So all of the user's needs (as determined by the client on this project) were much better met by this custom salesforce lookup than by the standard lookup. They could quickly find the contact that they needed from those at the account they were working with.

If you have a need for a custom salesforce lookup, or any apex or visualforce development, please reach out to us at www.snapptraffic.com - we'd be glad to discuss your salesforce.com development project, quote it, and get it built for you.