This is a technical post and will only be helpful if you are a Salesforce Admin/Developer. Please feel free skipping this post to check other business and tech posts.
Problem Statement:
You just closed your FY20 and are trying to assess how many sales engineers were part of the opportunity team and voila! You realize you never captured this data. Now before you build a process or automation and capture this info for this new fiscal, you wanna do a historical update on all closed deals from the last year.
How do you do it?
To do massive updates in one go on Salesforce, you will either use Dataloader or Workbench to do so.
Challenge:
Inserting Opportunity Team members in the backend on Salesforce is not as straightforward as other objects. It is a two-step process and in the step one you might run into the following error:
Row Cause: Bad Value For Restricted Picklist Field: <name of the team member value you are inserting>
Resolution:
Let’s start with the process of inserting Opportunity Team Roles to Salesforce.
Step 1: Here we will give the inserted team user, necessary rights to the respective opportunity.
Create a CSV with following columns and insert it to Salesforce via Dataloader or Workbench on OpportunityShare object.
- Opportunity ID (the opp where you want to add the team member)
- OpportunityAccessLevel (rights to Edit/Read the opp)
- User ID: The ID of the user who needs to be added to the team

Step 2: Now that we have given rights to the user, we need to build the relationship between them and the opportunity – this is where we add them as an Opportunity Team user.
Create another CSV with following columns and insert to Dataloader or Workbench on OpportunityTeamMember object:
- Opportunity ID (the opp where the user needs to be added as team member)
- User ID (the user’s ID)
- TeamMemberRole (What would be there role?)

You will run into RowCause Error: Bad Value For Restricted Picklist Field: <name of picklist value> occurs when you try adding TeamMemberRole into the first step as suggested by this Salesforce documentation which is incorrect. You will start seeing a column RowCause right at the time of insert.

And if you still went ahead with it, you will see error results associated with the RowCause.

Basically the error is telling you it can’t figure how to add the team role to the UserID coz the opp is not associated to the UserID yet and hence the UserID is not related to the opp yet via TeamMember role . And hence the first step is to give user edit rights to the opp and the second step is to give them a team role to associate with.
I hope this helps. Write back if you need help.