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

Filtering ContactRoles in Opportunities

I would like to add ContactRoles for Particular Opportunities in Opportunity Related List.
If i click on New Button in ContactRoles, it is redirecting to another page where i can see
Contacts Lookup and the Role of Contact to be selected. If i click on Lookup icon, all the Contacts are appearing which is bad
but i only want to see the Contacts of Particular Opportunities Account.
How can i restrict other contacts to be appear in Contact Lookup?
You will have design a custom visualforce visualforce page which is gets opened from the opportunity detail page button. In this button you will have to develop custom Lookup, you can headstart here - (" target="_blank)
Also you will need to create an inline visualforce page on opportunity to display existing contact roles, you may have the detail page button on this inline VF instead.
There is no standardway to filter the contacts displayed on the ContactRole page.

Please mark it as the Best Answer if it helps you, will be useful for others.
Thanks Lakshman.
I implemented this and it doesn't work. Because the ContactRoles is system object and it doesn't allow us to create custom button on its related list
Yes thats why you will need an inline visualforce page to display ContactRoles and depricate the use of standard ContactRoles related list.