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
BGrimesBGrimes 

Setting Access Levels in AccountShare doesn't reflect in UI?

Hi - I'm having a problem doing something in an Apex classe/trigger that I've been able to do in .NET, and that is add users to the AccountTeamMember object and then set their AccountShare access levels.  Currently I have a trigger that fires and at the tail end of it calls a class that will insert group members onto the account team (AccountTeamMember table) and then attempts to set their access levels.  I get the members added as well as the access levels set..both verified by my unit tests. Here is my test after adding two members to the account team, setting their access and then verifying the results (once I parse out the other team members/sharing users that I don't care about):
 

20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 108, column 11: listMembers size = 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 111, column 41: SOQL query with 4 rows finished in 3 ms20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 113, column 4: listAccessShare size = 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 117, column 4: SelectLoop:LIST:SOBJECT:AccountTeamMember20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: Number of iterations: 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: Number of iterations: 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 117, column 4: Number of iterations: 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 127, column 10: listShare size = 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 130, column 11: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 134, column 13: user: USERXXXXXXX account access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 135, column 13: user: USERXXXXXXX contact access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 136, column 13: user: USERXXXXXXX oppty access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 137, column 13: user: USERXXXXXXX case access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 134, column 13: user: USERYYYYYY account access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 135, column 13: user: USERYYYYYY contact access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 136, column 13: user: USERYYYYYY oppty access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 137, column 13: user: USERYYYYYY case access: None

It all looks good in the unit tests.  But when I try this in the UI the trigger fires as expected, but the results are that the two people have Read Only for account and contact, and None for opportunity and case (which I'm cool with).

 

Any ideas?   I can also query Salesforce db and see that they two people are in the AccountShare table with the PROPER access rights...but still nothing in the UI.  Am I missing something on the AccountTeamMember table?  I want to alter the AccountAccessLevel value there, but it's not accessable in the API.  

 

I'm beyond stuck on this one.  

 

Cheers,

Bryan 

BGrimesBGrimes
Here's a little cleaner test output: 
 
listMembers size = 2
listAccessShare size = 4
SelectLoop:LIST:SOBJECT:AccountTeamMember
SelectLoop:LIST:SOBJECT:AccountShare
Number of iterations: 4
SelectLoop:LIST:SOBJECT:AccountShare
Number of iterations: 4
Number of iterations: 2
listShare size = 2
SelectLoop:LIST:SOBJECT:AccountShare
user: UserXXXXXXX account access: Edit
user: UserXXXXXXX contact access: Edit
user: UserXXXXXXX oppty access: None
user: UserXXXXXXX case access: None
user: UserYYYYYYY account access: Edit
user: UserYYYYYYY contact access: Edit
user: UserYYYYYYY oppty access: None
user: UserYYYYYYY case access: None
 
Thanks.