function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kar123kar123 

Update Account Share Object through data loader - Error

Hi All,

 

I need to update the Account, Opportunity and Case access for an Account Team Member. Account shluld be Read Only while Oppty and Case should be Private. 

 

I tried exporting the Account Share Object and update the Account, Opportunity and Case access fields to READ, NONE, and NONE respectively using data loader. But I get an error saying Invalid record Id and sometimes I get; iNTEGRITY EXCEPTION: ROW CAUSE (cannot update sharing row with this cause)..pls advise what can be done to fix this.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
kar123kar123

Figured out. I just filtered my query by adding rowcause =  'Team'.

All Answers

SurekaSureka

Hi,

 

I tried the following code to update the Case Access Level.

 

List<AccountShare> accShareUpdate = new List<AccountShare>();

Id accId = x;

List<AccountShare> accs = [select UserOrGroupId, CaseAccessLevel,AccountId from AccountShare where AccountId =: x];

for(AccountShare accShare: accs)

{

accShare.CaseAccessLevel = 'Edit';
accShareUpdate.add(accShare);

}

update accShareUpdate;

 

Let me know if it works.

 

Thanks

 

kar123kar123

Figured out. I just filtered my query by adding rowcause =  'Team'.

This was selected as the best answer