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
Drew1815Drew1815 

Resetting Account Shares after Account Ownership Update through API

I am having some issues with Account Shares as it pertains to Account Team Members after the Account Owner has been updated through the API. By updating the Account Owner, the Account Shares for each Account Team Member is removed implicitly by the API Update call. The issue I am trying to programmatically fix is that by having each Team Member corresponding Account Share RowCause="Manual" and not set to "Team", the Account Team Member Related List displays the Org Wide Default Sharing Rule for Account Access which is "Public Read Only." Functionally, the Account Share still has "Edit" privileges granted for each Team Member so those end-users still have full functionality. But my problem is that the UI displays the Org Wide Default Rule instead of the granted Team Share which has been deleted by the API.

Furthermore, using the API, I have logic in my code that tried to re-create the Account Shares after the Account Owner has been updated. That create call for Account Shares is successfully, but simply updates the Account Share where RowCause="Manual". So the UI related list doesn't reflect the 'Edit' privileges granted to those team members. It appears that the Related List for Account Team Members displays the Org Wide Default for Account Access if and only if there is no corresponding Account Share for that same User where the RowCause="Team." Is that correct? Is that valid behavior? How can I set the RowCause?

Question - How can I get the Account Team Member Related list to show "Read/Write" after an Account Owner has been changed and the corresponding "Team" Account Shares have been deleted?