Sub topic 9
Contact roles and opportunity teams
This chapter covers the two ways Salesforce records who is involved in a deal. Contact roles record the customer's people. Opportunity teams record your own people. This chapter assumes you know how Accounts, Contacts and Users relate, you can open Setup, and you know the Opportunity fields and stages from earlier chapters.
Why a deal needs more than an account
An opportunity has an Account lookup, but an account is a company. Real deals involve several buyers, such as a champion, a budget holder and a technical evaluator. On your side, a deal may involve a sales rep, a solutions engineer and an executive sponsor.
Salesforce models both groups with junction records, which are records that link an opportunity to another object:
| Question | Feature | Links the opportunity to | Object API name |
|---|---|---|---|
| Who at the customer is involved? | Contact roles | Contacts | `OpportunityContactRole` |
| Who on our side is involved? | Opportunity teams | Users | `OpportunityTeamMember` |
Both give you a many-to-many relationship. One contact can appear on many opportunities, and one opportunity can have many contacts.
Contact roles
What a contact role holds
An OpportunityContactRole record has three useful fields:
- Contact: the person involved.
- Role: a picklist value describing their part in the decision, such as Decision Maker, Economic Buyer, Executive Sponsor, Influencer, Technical Buyer, Evaluator, Business User or Other.
- Primary: a checkbox (
IsPrimary). Only one contact on an opportunity can be primary.
You can edit the Role picklist values in Setup. Search for "Contact Roles on Opportunities". Match the values to how your team describes buyers. If reports must compare roles across teams, agree on one list before you change it.
Adding contact roles
Reps usually add roles from the Contact Roles related list on the opportunity record page. They choose Add Contacts, pick one or more contacts, then set each role and optionally mark one as primary.
A contact does not have to belong to the opportunity's account. This helps when a consultant, a parent-company executive or a partner contact influences the deal. It also means that Salesforce does not stop a rep from attaching an unrelated contact by mistake.
Contact roles also appear in other places:
- Lead conversion. If you create an opportunity while converting a lead, the converted contact is added to it as a contact role. That contact is normally marked primary. The earlier chapter on lead conversion covers this in detail.
- Contact record pages. The Opportunity Contact Roles related list on a contact shows every deal that person is part of.
Requiring a contact role
Administrators can make contact roles mandatory. In Setup, open Opportunity Settings and look for the option that requires a contact role when an opportunity is saved. Check the exact label in your org, because it has changed between releases. Once enabled, users cannot save a new opportunity without one. This setting only applies to creation, so reps can still delete roles later.
To require a role at a given stage, use a validation rule or flow instead. Validation rules cannot easily count related records, so many teams use a roll-up approach, such as a flow that sets a checkbox, or a before-save check in a record-triggered flow. Design it carefully, because every stage change will evaluate it.
Using the primary contact
The primary contact is the person the deal is "about". It is used in these ways:
- Reports can show the primary contact by filtering on the primary flag in an Opportunities with Contact Roles report.
- Some email and engagement features use the primary contact as a default recipient.
- Automation can read it to personalize messages or tasks.
Because only one primary is allowed, changing the primary in the UI moves the flag. It does not create a second primary.
Querying contact roles
The following SOQL query lists the people on one opportunity, primary contact first. Replace the placeholder with a real record ID.
SELECT Contact.Name, Contact.Email, Role, IsPrimary
FROM OpportunityContactRole
WHERE OpportunityId = '006XXXXXXXXXXXXXXX'
ORDER BY IsPrimary DESC, Contact.NameTo find open deals that have no contact roles at all, use a semi-join with a NOT IN subquery:
SELECT Id, Name, StageName, OwnerId
FROM Opportunity
WHERE IsClosed = false
AND Id NOT IN (SELECT OpportunityId FROM OpportunityContactRole)This query is a good basis for a data-quality report. In the report builder, the equivalent is the "Opportunities with Contact Roles" report type, changed to show opportunities with or without contact roles.
Opportunity teams
What a team is
An opportunity team is a set of users who work on one opportunity alongside the owner. Each OpportunityTeamMember record holds:
- User: the team member.
- Team Role (
TeamMemberRole): a picklist such as Sales Rep, Account Manager, Pre-Sales Rep, Executive Sponsor or Channel Manager. You can edit the values in Setup. - Opportunity Access (
OpportunityAccessLevel): Read Only or Read/Write.
Teams are not on by default. In Setup, search for "Opportunity Team Settings" and enable Team Selling. After that, the Opportunity Team related list becomes available. Add it to your page layout or Lightning record page if it does not appear.
Access: the main reason teams exist
Team membership is a sharing mechanism. If your organization-wide default for opportunities is Private, a user who is not the owner, not above the owner in the role hierarchy, and not on the team cannot see the deal. Adding someone as a Read/Write team member gives them edit access without moving ownership.
Remember these rules:
- A team can grant more access than the org-wide default. It cannot grant less.
- Access applies to the opportunity. It does not extend to the account unless account sharing grants it separately.
- Removing a member removes the access that came from the team. The user may still have access through the role hierarchy or another sharing rule.
- Team members do not receive credit for the deal. Ownership and splits determine that.
Default opportunity teams
Each user can define a default team. They do this in their personal settings under Advanced User Details, using Default Opportunity Team. Typical members are a regular solutions engineer and a sales manager. When that user creates or takes ownership of an opportunity, the default team can be added automatically. The user can choose whether to add the team.
Changes to a default team do not rewrite teams on existing deals. Update those opportunities directly, or use the option to add the default team to existing opportunities if it is offered.
Querying team members
The following query lists a deal's team with their access levels:
SELECT User.Name, TeamMemberRole, OpportunityAccessLevel
FROM OpportunityTeamMember
WHERE OpportunityId = '006XXXXXXXXXXXXXXX'
ORDER BY TeamMemberRoleTeams versus splits
Team selling can be combined with opportunity splits. Splits divide credit for revenue (or another amount) among team members by percentage. They are a separate feature with their own setup, and they feed forecasting. Without splits, only the owner gets credit. Treat the team as "who works on it" and splits as "who is paid or credited for it".
Common errors
- No primary contact. Reps add several roles but never tick Primary. Reports and automation that rely on the primary then return blanks. Fix this with a flow or a data-quality report.
- Roles left blank. A contact added without a role is hard to analyze. Make the Role field part of the habit, or check for it in a report.
- Team grants lower access than expected. A team member with Read Only access still cannot edit the deal. This is not a bug.
- Expecting a team to override a lower level. A team member is given the highest access among all sources. If the user already has Read/Write from the hierarchy, a Read Only team entry does not reduce it.
- Using the team for the customer's side. Customer contacts belong in contact roles. Team members must be users.
- Assuming a default team updates old deals. It does not.
Summary
Contact roles tie customer contacts to a deal and describe their influence, with one optional primary. Opportunity teams tie internal users to a deal, with a role and an access level, and they can widen sharing beyond the org-wide default. Both are junction records you can query, report on and enforce through automation.
Exercise
A deal's owner is in the Western region. A pre-sales engineer in the Central region must edit the opportunity, but your org-wide default for opportunities is Private. Which feature do you use, which fields do you set, and what do you add to the opportunity so you can tell the buyer's technical evaluator from the budget holder?
Show answer
Use an opportunity team. Add the engineer as a team member with Team Role Pre-Sales Rep and Opportunity Access set to Read/Write. This grants edit access without changing the owner. To tell the buyer's people apart, add them as contact roles. Set the evaluator's Role to Evaluator or Technical Buyer and the budget holder's Role to Economic Buyer or Decision Maker, and mark one as primary.
Exercise
Write a SOQL query that returns the name and stage of every open opportunity that has no contact roles.
Show answer
SELECT Name, StageName FROM Opportunity WHERE IsClosed = false AND Id NOT IN (SELECT OpportunityId FROM OpportunityContactRole)