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
agambeer singhagambeer singh 

Can somebody define me the relationship between contact and opportunity...... how contact role play role in defining there relationship

i am new  to salesforce help me ?
Best Answer chosen by agambeer singh
Tushar KhorateTushar Khorate
Hi Agambeer,

Account - Contact  and  Account - Opportunity have a Special Lookup relationship.

Simply putting, Account is a parent of both Contact and Opportunity. 

Here lookup relationship is treated as Master-Details relationship. If we delete Account record, that related contact and Opportunity records are deleted automatically from the database. 
 
 But here lookup relationship field is not mandatory field like master details relationship field. ( i.e. the relationship is Lookup on UI and master detail at the backend).
For more reference you can visit : http://success.salesforce.com/ideaView?c=09a30000000D9y3&id=08730000000JL3KAAW (http://success.salesforce.com/ideaView?c=09a30000000D9y3&id=08730000000JL3KAAW)

Mark it as best answer so others can also see this who want help.

Regards, 
Tushar

All Answers

CharuDuttCharuDutt
Hii Agambeer
Opportunities have a relationship with an Account record, and the Account has a relationship with Contacts – yet, no direct relationship.To get around this, Salesforce developed an object called ‘Contact Roles’, which creates a link between Contacts and the role they play in an Opportunity.

A>Each Contact Role record has 4 standard fields: The Contact’s Name
B>Their Job Title
C>Their Role – default roles include Decision Maker, Evaluator Business User, with the ability to add values to this picklist.
D>Primary – a checkbox field to single out one particular contact above the rest.


Please Mark It As Best Answer If It Helps
Thank You!
Tushar KhorateTushar Khorate
Hi Agambeer,

Account - Contact  and  Account - Opportunity have a Special Lookup relationship.

Simply putting, Account is a parent of both Contact and Opportunity. 

Here lookup relationship is treated as Master-Details relationship. If we delete Account record, that related contact and Opportunity records are deleted automatically from the database. 
 
 But here lookup relationship field is not mandatory field like master details relationship field. ( i.e. the relationship is Lookup on UI and master detail at the backend).
For more reference you can visit : http://success.salesforce.com/ideaView?c=09a30000000D9y3&id=08730000000JL3KAAW (http://success.salesforce.com/ideaView?c=09a30000000D9y3&id=08730000000JL3KAAW)

Mark it as best answer so others can also see this who want help.

Regards, 
Tushar
This was selected as the best answer
Tushar KhorateTushar Khorate
In Salesforce, Contact records do not have a direct relationship with Opportunities.
Opportunities have a relationship with an Account record, and the Account has a relationship with Contacts – yet, no direct relationship.
What is contact role

Each Contact Role record has 4 standard fields: The Contact’s Name
Their Job Title
Their Role – default roles include Decision Maker, Evaluator Business User, with the ability to add values to this picklist.
Primary – a checkbox field to single out one particular contact above the rest.

In First Query:
account ac =[select id,name ,(select id,anme from contacts) from account];
Contact have lookup to Account so you can Query like that
In second Query :
List<contact> consobj=[SELECT id,firstname,(SELECT OpportunityId FROM OpportunityContactRoles) ,lastname FROM contact ];

Hope this will help you. Mark it as best answer so others can also see this who want help.

Regards, 
Tushar
Rosie StoutRosie Stout
I am a student at the university of business and international relations. I am a future entrepreneur, and I read daily a lot of information and essays on how to make a perfect business plan. Besides this, the source I use https://phdessay.com/free-essays-on/entrepreneur/ provides valuable data about determining good dealing opportunities. I also study sales offers and investment possibilities in nowadays world. Online resources like salesforce are helpful for me because I create a base account for my future deals. I hope you find something on the site I suggested that will help you as I get utility.