Last Updated on November 12, 2017 by Rakesh Gupta
Opportunity Contact Role represents the role of Contact/Person account on an Opportunity. There is many-to-many relationship between Opportunity and Contact, through a junction object called OpportunityContactRole. In an opportunity, you may add many opportunity contact roles. There is no restriction on Account from which the Contact can come, you can add any Contact from any Account. For example, Rakesh Gupta might be the Executive sponsor for the opportunity “Universal Container”, and Edna Frank might be the Quality Control for same Opportunity.
How to define Contact Role?
According to your business requirement, you can modify contact role for Opportunity.
To define contact role for Opportunity follow the steps Name > Setup > App Setup > Customize > Opportunities > Contact Role
If you want to add new role click on “New” Button, for reorder or make some value default click on “Reorder” button and save it.
Contact Role fields?
Below is the list of contact role standard fields, which Salesforce does not allow us to add any new custom field on Opportunity Contact Role.
How to add contacts as a Contact Role inside Any Opportunity?
First, choose the Opportunity in which you want to add Contact Role, then go to “Contact Role” related list click on “New” button.
Select Contact and its Role for particular Opportunity. You can make any contact as primary.
And Click on Save. You can add the same contact as many times in Contact role for same opportunity.
Scenario: – Few days back I got one requirement where a user wanted to update Name of all Tasks with “Primary Contact role “related to an opportunity when contact role is updated as primary.
Note: – There is certain restriction on this object unlike other system objects
- We can’t add any custom fields into OpportunityContactRole Object.
- We can’t add any validation rules on OpportunityContactRole object.
- We can’t create any trigger on this OpportunityContactRole Object.
To implement above scenario we have to use Apex Schedule class and Inline VF page concept. I will explain these concepts on my next blog.
Related Ideas:- Make Opportunity Contact Roles RecordType Specific
13 thoughts on “Opportunity Contact Role”
Vijay Nandi
I like the valuable information you supply for Salesforce through your articles.
I will bookmark your weblog and take a look at again right here regularly.
Good luck for the next!
Shridhar Patankar
Is there a way to add custom button on Opportunity Contact Role to create dynamic contacts?
Rakesh Gupta
No you can’t. That’s standard behaviour. You can’t customise contact role given in the related list of opportunity, account etc. what is your requirement?
Shridhar Patankar
I need to dynamically Add Contact with a button if not present in LOOKUP at the the time of adding records. That means on the edit page.
What I thinking is to have custom object related list which will be exact replica of Contact Role and saving it in a standard OpportunityContactRole, so that it won’t impact a general behaviour.
Please let me know if you have some code for this.
Rakesh Gupta
Sorry, I didn’t get you.
Brian Ford
I have a trigger on the opportunity that counts the number of contact roles. When a new contact role is added, the trigger doesn’t fire until the associated opportunity is edited. Anyway to automatically fire the opportunity trigger when a new contact role is added?
Rakesh Gupta
Yes you can, I achieved requirement mentioned in this article using Inline Visualforce Page (Contains logic to find primary contact and update the Task) on Opportunity.
Arden Bjerkeli
I can accept that they don’t want us messing with the Contact Role object. But I want to write a validation rule on the Opportunity object if the number of Contact Roles is zero. Is there a way to access that number?
Rakesh Gupta
Yes through Apex trigger. Write one apex trigger on Opportunity object.
Thomas
Are you able to pull in ContactRole to view in the Salesforce1 app?
Rakesh Gupta
I never tried this,give me few days I will try and let you know.
johanyu
Rakesh, nice blog.
Reading the user requirement “user wanted to update Name of all Tasks with “Primary Contact role“ related to an opportunity when contact role is updated as primary”, assume this include to create new Task related to Opportunity and Contact and assign to Opportunity owner?
Rakesh Gupta
Thanks Johan,
Yes you are right.