Print this page

How can Opportunity Teams be added / removed using the Data Loader?

Knowledge Article Number 000193770
Description
When adding an Opportunity Team Member in the user interface (UI) both an OpportunityTeamMember record and OpportunityShare record are automatically created.

When creating team members in the UI Salesforce automatically creates and sets a related Opportunity Share record via your "Opportunity Access" selection when creating team members via the Opportunity Team Members page.

Where as with the API, it's not possible to directly specify or set the corresponding OpportunityShare record's access level when inserting OpportunityTeamMembers 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 inserting 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 How do I specify the Access Level when importing Account Team Members / Opportunity Team Members? article.

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.

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.

 
Resolution

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 the Data Loader and choose to perform an Insert operation to 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.



See Also:
Adding a Team Member to Multiple Records
How do I specify the Access Level when importing Account Team Members / Opportunity Team Members?
How can Account Teams be added / removed using the Data Loader?





promote demote