function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Swami DeshanelSwami Deshanel 

How to create a custom visualforce Search for contacts based on fields on the contact and related Account.

Ideally what I would have is a visualforce page that would lauch from the Opportunity, bringing up a Contact search that allows you to input various contact and account filters, and then it brings up a list of contacts whcih could be slected with a check box, and another button that would then add those contacts to the campaign set as the Primary campaign souce of the Opportunity.  

I believe I will need a visualforce page and a class.  

I have no trouble launching a visualforce page from a button, or creating a junction object from Contact to Opportunity if necessary.   It would also be great if it could prefill some of the search criteria based on Opportunity Fields (for example, Opportunity Type is "Entertainment, then the search would already prepopulate the account search field Account Type with "Entertainment").   Then the search would bring up all the contacts that would would fit those filters.   
PratikPratik (Salesforce Developers) 
Hi Swami,

This should help:
http://blog.jeffdouglas.com/2010/07/13/building-a-dynamic-search-page-in-visualforce/

Thanks,
Pratik