I observed in many salesforce communities that lot of salesforce people facing challenges in associating one contact with multiple accounts, cases, Contracts, or Opportunities.
In salesforce, architecture Contact has a Standard Account field, which means a Contact can be associate with on account.
However we can create few more Custom lookup fields on Contact to associate few more accounts, but that will not be a good approach to achieve this requirement if you want to associate one contact to n number of accounts, cases, or opportunities.
In order to achieve this requirement, salesforce has provided a standard functionality i.e Contact Roles.
A Contact Role is the position/post of contact for any account, Case, or opportunity. Contact can have multiple roles for n numbers of accounts, case, or opportunity. Contact roles is the way to establish many to many relationships with Contacts and accounts, Contacts and cases or contacts, and opportunities.
For example, Sameer Tyagi is the contact in Salesforce for Account XYZ Company and he is also decision-maker for PQR Company and Evaluator for ABC Company.
Internally Salesforce has provided Standard separate objects Account Contact roles, Opportunity contact Roles, and Case object roles.
Setting up Contact Roles in Salesforce
Setting up contact Roles in Salesforce is very easy, there is no code required to set up.
1- If you want to set up contact roles for an account, you need to follow these steps.
Got to Setup>Customize>Accounts>Contact Roles as shown in the image below
2- Define all roles which you want to use in Salesforce as shown in the image below, these are the picklist values that you will get when you create any contact role under the account.
3- Show contact roles related list on Account page Layout as shown image below
Associating a Contact Role with Account.
1- Open an account and go to Contact role-related list under the account and add new contact role and select contact
and set role for the contact for that account as shown in series of images below.
2- Click on the new button.
3- Add Contact and set role
In terms of technical aspect Account Contact role is the standard object in salesforce, which has a lookup field on Account and a Lookup field on Contact with a picklist which contains some values, which you define in Account contact role settings page so that it can be used to establish many to many relationships in Accounts and Contacts.