Visualforce Custom lookup visualforce page

apex-codesalesforcevisualforce

I was wondering if there is a way to override the native functionality of the lookup field in Salesforce and replace it with a visualforce page. The reason I'm trying to override this button is because when the user does a look up, the look up returns everybody with that name. What we want to return is a list of all the contacts by account for the contact being searched.

Here's what I'm trying to achieve:

When the user clicks the lookup button my visualforce page will launch and allow the user to see the account and all the contacts of that account.

Is this even possible? What other ways would you suggest going about this?

Here's a screen shot of what I'm trying to change:

enter image description here

Thanks for all your help!

Best Answer

It sounds really like you just need to customise the columns on the lookup to make it better suited to your needs. If you go to Setup -> Customize -> Contacts -> Search Layouts, you'll see entries for Lookup Dialogs and Lookup Phone Dialogs, there you can edit the columns displayed in the lookup windows.

If you really need a custom solution:

You can't override the lookup page itself, but you could create a new visualforce page for your account, using <apex:detail> and other similar tags to make your life simpler. Then you could include a search section underneath, where a user can enter various search terms which you put into a dynamic SOQL query and then render the results for them to choose from.

Related Topic