Sub topic 11
Opportunity Teams and Case Teams
This chapter assumes you know how account teams work, how org-wide defaults set the baseline, and that record access is stored as share rows. Opportunity teams and case teams use the same idea as account teams, but they attach to a single record.
What these teams do
An opportunity team is a group of users who work on one opportunity. A case team is a group of users who work on one case. Each member gets a team role and an access level on that record. Team access can only open access up. It cannot take away access a user already has from ownership, the role hierarchy, or a sharing rule.
The access you can grant depends on the org-wide default for the object:
| Object default | Team access levels you can give |
|---|---|
| Private | Read Only or Read/Write |
| Public Read Only | Read/Write |
| Public Read/Write | None needed, everyone already has it |
Enable the feature first
Neither team type is on by default. In Setup, enable opportunity teams under Opportunity Team Settings. Enable case teams under Case Team Roles, where you also create the roles. Without roles, you cannot add members to a case team.
How the pieces fit
Opportunity teams
Opportunity team members have a role, such as Sales Engineer or Executive Sponsor, and an access level for that opportunity. A user can also keep a default opportunity team. When that user creates an opportunity, the default team is copied onto it. The copy is optional, and you can choose to add the team to existing opportunities.
Opportunity teams can also receive credit through split settings if your org uses opportunity splits. That is a revenue feature, separate from record access.
Case teams
Case teams work for support cases. Members can be users, contacts, or customers, but only users receive record access. You create case team roles, then a predefined case team that groups members. Support agents can apply a predefined team to a case in one step.
A case team role also has an access level, set when you define the role. Pick the lowest level that lets that person do the job.
Inspecting team access
Team members are stored in their own objects, and their access appears as share rows. You can query the team members the same way you query account team members:
SELECT Id, OpportunityId, UserId, TeamMemberRole, OpportunityAccessLevel
FROM OpportunityTeamMember
WHERE OpportunityId = '<opportunity record Id>'Use this to confirm who is on the team and at what level. To see the effect on access, query the share object for the record, as you did in the share objects chapter, and read the RowCause column.
Common errors
- The team member cannot see the record. The account may still be private to them. Check whether the parent access is needed for your process, because team access applies only to that opportunity or case.
- Access level cannot be set higher than the default. If the object is Public Read/Write, there is nothing to grant.
- Removing a member does not remove other access. The user may still see the record through the role hierarchy or a sharing rule.
- Team missing on a new record. Default teams are copied only if the user has one and the option to copy it is on.
Exercise
The opportunity object is Private. A sales engineer is added to one opportunity's team with Read Only access. The engineer is not the owner and is not above the owner in the role hierarchy. What can the engineer see, and which query shows the membership?
Show answer
The engineer can read that one opportunity only, and no other opportunities. Query OpportunityTeamMember filtered by OpportunityId to see the member, role, and OpportunityAccessLevel.