We're using apex to dynamically add/remove users to Account teams which seems to be working fine but we're noticing that users added are only getting Read access to Opportunities after being added to the Account Team.

The code below sets OpportunityAccessLevel to Edit although, it's only coming through as Read Only. A solution is to set the OWD to public read/write but that completely defeats the purpose of using Account teams to limit access.

Any thoughts on what we're missing on this?

private static AccountTeamMember createAccountTeamMember(string accId,string userId,string roleName){
    AccountTeamMember act = new AccountTeamMember();
    act.AccountId = accId;
    act.UserId = userId;
    act.TeamMemberRole = roleName;
    act.AccountAccessLevel = 'All';
    act.CaseAccessLevel = 'All';
    act.ContactAccessLevel = 'Edit';
    act.OpportunityAccessLevel = 'Edit';
    return act;

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.