When adding a user to an account team you can set four separate access levels for accounts, cases, contacts, and opportunities. However, the AccountTeamMember object only has a field for AccountAccessLevel according to the object describe and standard data model docs and that field isn't writeable. Where does the access level for the other three fields live and how can I set all four programmatically? I've googled around and reviewed other team member objects and none of them seem like a fit, but no dice.

Account Team Edit

  • I believe these are on UserAccountTeamMember.
    – Ashwani
    Commented Nov 1, 2013 at 8:53
  • @regal I thought so too, turns out that is stored the default account team members for a user. Commented Nov 2, 2013 at 17:50

1 Answer 1


When you create an Account Team Member in the browser UI, Salesforce creates two objects: an AccountTeamMember and an AccountShare. I believe these fields are on the AccountShare. Fields are AccountAccessLevel, CaseAccessLevel, ContactAccessLevel and OpportunityAccessLevel

When doing this in Apex, you will need to explicitly create both object records if you want both record sharing and Account Team.

  • 1
    Actually, AccountTeamMember automatically creates an AccountShare. You need to query the AccountShare, then update the access levels... The AccountShare entry will have AccountId set to the account, the UserOrGroupId set to the user in the team member, and the RowCause will be "Sales Team".
    – sfdcfox
    Commented Nov 1, 2013 at 21:26
  • @sfdcfox looks like there is some magic behind the scenes, when i tested inserts for both AccountTeamMember and AccountShare are treated like upserts, keyed on the account id / user id combo. So you can kind of dumbly insert stuff and Salesforce keeps it in order. Commented Nov 2, 2013 at 17:50
  • Sharing does have some magic. I know that "RowCause" is read-only, the docs say so, but it looks like you can still insert it as long as it already exists (like an upsert). Good catch there.
    – sfdcfox
    Commented Nov 2, 2013 at 18:52
  • I didn't realize the AccountShare record was created automatically, since I always have to insert a new one to handle sharing access levels, and I never received an exception when inserting a new one. Commented Nov 2, 2013 at 21:47
  • 1
    Very old thread, but I just learned of a critical note. When creating an AccountTeamMember via apex, the AccountShare will be automatically created based on the access levels specified on the AccountTeamMember, but ONLY IF each of the specified access levels is equal to or greater than that of the corresponding OWD access. If any access level is below that of OWD, the AccountShare simply doesn't get created. Commented Jan 20, 2023 at 1:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .