Account team mass update access level using data loader

Lets take a brief look at what is a account team:

A account team is team or say group of users who work together on a particular account. Each account record may have its own team. Each user of this team will have its role defined. Each user will have its access level defined for Account, Opportunity of that account,Case's of that account.

Account team object has fields OpportunityAccessLevel, CaseAccessLevel, AccountAccessLevel to store value for access levels. Access levels could be private, Read/Write and Read.

Ever tried updating Opportunity access level or Account access level for a account team using data loader?
Well, if you did try and could not find the fields OpportunityAccessLevel or AccountAccessLevel you are not at fault !!!

These fields aren't available in data loader for Account Team object!!

Then, How can we do mass updates for these fields?

We can do this using the account share object. Account share object represents a sharing entry on an Account.
This object stores records that indicate which user or group has what kind of access to a particular account record.

Say for example if Account A can be Read/Write by 2 users user1 and user2 then there will be two entries in account share object plus one more entry for the owner of the account. So total three records which will store the account id, access level, and user id.

As we have seen above that an account team actually consists of users, so there will be one entry in AccountShare for each user that constitutes a account team.
Thus we can update these account share records to update the accesslevels which will ultimately update the Account Team access levels.

Lets discuss an example of account team,
An account "TestAccount" has a account team as below,

So, there will be two records of account share associated with this account(1 for account owner and one for account team member). If there were two account team members the total account share records would have been 3.

So now to update the account team members Opportunity access level or account access level we will need to update this first record in picture.

You just need to give the accountId , userorGroupId and whichever access level you need to give.
Values for Opportunity/AccountAccesslevels needs to be either of these: Edit,Read,None (first letter need to be capital).

If a account share record is inserted and if it matches a existing record then the original record is modified with the new field updates.
For example, in the above case when we created a account team member salesforce automatically created a accountshare record for it.
Here when we tried inserting new account share record for the same account id and user id but with new access level it updated the already existing record with the new access level.

1 comment:

  1. How to you update an existing list of Account team member and add an additional user?