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
WycadoWycado 

Opportunity Contact Roles Filtering

I would like to modify the filters on the standard Contact Lookup field on Opportunity Contact Roles to filter on the following:

1. Present only Contacts associated with the Account related to the Opportunity (standard function)
2. Present only Contacts associated the the "Contact Roles" standard related list on the Account related to the Opportunity (custom function)
3. Present only Contacts associated with the Account shown in a custom Opportunity lookup field. This is not the Account related to the Opportunity, but a different Account

Contact that met any of these criterion would be the only ones shown in the "Contact Role" lookup on the Opportunity record. 

Can the Apex in the standard Opportunity Contact Roles be accessed and modified to do this?
Sonam_SFDCSonam_SFDC
I researched on this and found that there is no option to add lookup filter to Opportunity Contact Role.
However, you can remove this related list from page layout and add section with custom Visual Force page

You can create a field on VF which gets a list of all the contacts that fall under your criteria.

check the following blog to get sample code:
http://thysmichels.com/2013/01/31/visualforce-lookup-field/