Loading

Error 'Field is not writeable: OpportunityTeamMember.OpportunityAccessLevel' on API insert of OpportunityTeamMember

게시 일자: May 1, 2026
상세 설명

When creating Opportunity Team Members via the API in an org where Org Wide Defaults (the organization-level sharing settings) are set to Private for Opportunities, a compile error occurs:

COMPILE ERROR: Field is not writeable: OpportunityTeamMember.OpportunityAccessLevel

This error happens because the OpportunityTeamMember.OpportunityAccessLevel field is not editable through the API when Org Wide Defaults are configured as Private for Opportunities. In this configuration, Salesforce does not allow the access level to be set programmatically via the API.

This error can be avoided by removing references to OpportunityAccessLevel from any Apex code that inserts new OpportunityTeamMember records.

솔루션

Solution: Omit the OpportunityAccessLevel Field:

OpportunityTeamMember records can still be created via API even when Org Wide Defaults are set to Private for Opportunities. The solution is to omit the OpportunityAccessLevel field from the Apex insert statement entirely.

Example: Successful Insert (Without OpportunityAccessLevel)

For example this code successfully creates a new Opportunity Team Member via API:

insert new opportunityteammember(OpportunityId='006000000000000AAD', TeamMemberRole='Account Manager', UserId='00500000000000OAA2');

Example: Failing Insert (With OpportunityAccessLevel)

This code returns the error because OpportunityAccessLevel is included in the apex insert statement.

insert new opportunityteammember(OpportunityAccessLevel='Edit', OpportunityId='006000000000000AAD', TeamMemberRole='Account Manager', UserId='00500000000000OAA2');

 

Knowledge 기사 번호

000384988

 
로드 중
Salesforce Help | Article