How can Opportunity Teams be added / removed using the Data Loader?
|Knowledge Article Number||000193770|
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.
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
- 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.
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.
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.
Note: Deleting an OpportunityTeamMember record also removes their OpportunityShare record and the team member record is not placed in the recycle bin.