Loading

Add or remove Opportunity Team members with Data Loader

Date de publication: Apr 2, 2026
Description
When you add an Opportunity Team Member in the user interface (UI) both an OpportunityTeamMember record and OpportunityShare record are automatically created. The Opportunity Share record is created based on the "Opportunity Access" selected when the team member is added via the Opportunity Team Members page.

When you insert OpportunityTeamMembers via API, it is not possible to directly specify or set the corresponding OpportunityShare record's access level so each will need to be inserted individually. Here is an explanation for each object you'll be working with when creating team member records via the API:

OpportunityTeamMember - This record stores the actual association between a User and the Opportunity as well as their role.
 
OpportunityShare - This record establishes the user's actual access to the Opportunity.

When you insert team members via the API their access is typically set to the least permissive default level of Read Only. Existing OpportunityShare records with a matching User and Opportunity Id combination will be updated from their existing access level to "Read Only" and their sharing reason will also be updated to reflect "Sales Team." There are a few exceptions to this as outlined in the Specify access level when you import Account or Opportunity team members

If you wish to set a more permissive Access Level for a newly inserted Team Member, you will need to run a subsequent insert to the OpportunityShare object to set the desired level of access.
 
Scenario: "For example, a sales ops admin needs to onboard a new overlay sales team of 200 reps across 1,500 open Opportunities, assigning each an 'Overlay Rep' team role with Edit access — too many to do manually in the UI."

Note: It's necessary to complete all 3 steps below in the order outlined for the team member's access levels to display properly in the UI.
 
Résolution

To add Opportunity Team Members to an Opportunity using the Data Loader:
 

1. Prepare a file with the following columns:

OpportunityId: The Record Id of the Opportunity to which a team member is being added

UserId: The Id of the user being added to the Opportunity Team

TeamMemberRole: The Opportunity Team Role for this user on this Opportunity. To find the list of valid Team Roles, go to Setup | Customize | Opportunity | Opportunity Teams | Team Roles

OpportunityAccessLevel: The Opportunity access level for the team member (or UserId). Valid values are "Read" or "Edit" and please note: "Read" or "Edit" in this field is case sensitive


2. Once the file has been prepared, open Data Loader and select the Insert operation on the Opportunity Share (OpportunityShare) object to set the appropriate OpportunityAccessLevel for the Opportunity Team Member users. The Opportunity Share object should be available by selecting the "Show all Salesforce objects" option in the Data Loader click Browse... and select your file | Open | Next > | Ok

- Select the Create or Edit a Map button and choose to Auto-match Fields to Columns.  Verify that the OpportunityAccessLevel and OpportunityId fields mapped automatically and manually map the UserId column to the UserOrGroupId field in Salesforce.

- Select the directory where the success and error files should be saved, then click "Finish".
 

3. Using the same file now perform a secondary Insert operation to the Opportunity Team Member (OpportunityTeamMember) object which should be available by selecting the "Show all Salesforce objects" option in the Data Loader click Browse... and select your file | Open | Next > | Ok

- Select the Create or Edit a Map button and choose to Auto-Match Fields to Columns. Verify that the OpportunityId, UserId, and TeamMemberRole fields are properly mapped.

- Select the directory where the success and error files should be saved, then click "Finish".


Note: The Opportunity Share records must be inserted before the Opportunity Team Member records. This ensures that the existing share records are properly linked to the newly created team members. If share records are inserted after team members, the team member access levels in the user interface may not properly reflect the sharing record's access levels.

Once the share and then team member records are inserted in the correct order they should be properly linked to one another and thus allow subsequent updates to the share records to be properly reflected in the related team member's access level via the UI.


To remove Opportunity Team Members from an Opportunity using the Data Loader:
 

1. Run an Export operation via the Data Loader against the Opportunity Team Member (OpportunityTeamMember) object. Set filter conditions of your choosing to selectively export the desired Opportunity Team Member records and ensure that you have stored a backup of the existing Opportunity Team member records.

2. When you are satisfied with the contents of your file perform a Delete operation via the Data Loader mapping the Opportunity Team Member's Id column.
 

Note: Deleting an OpportunityTeamMember record also removes their OpportunityShare record and the team member record is not placed in the recycle bin.

Numéro d’article de la base de connaissances

000383667

 
Chargement
Salesforce Help | Article