You need to sign in to do that
Don't have an account?
Sharing over the entire account heirarchy
I manage account sharing using APEX (accountshare table). If that user is specified in the lookup (Account manager) he is given access to that account(and related contact and opportunities). But, the problem is when the account is part of a tree. Likethis
A
|
______________
| |
B C
_____________
| | |
D E F
So if a user is specified in the manager lookup in account E, I need to make sure he has full access to the entire tree:A.B.C.D.E.F. I have seen that giving the user access to A does not give him access to accounts lower down in the heirarchy automatically.
Any ideas?
-
Don't know who the customer is, but that is a really odd requirement.
But if that is the requirement, I think the solution is doing a little tree-walking like this:
1. Write a routine to get the parent of E and recursively go up through the Account parent tree until it reaches an Account without a parent.
2. Add a share for the account.
3. Find all accounts that have this Account as the parent.
4. For each of the Accounts returned repeat steps 2 - 4 until no accounts are returned.
This a classic tree-walking algorithm and will require an understanding of how to build recursive routines.
Hope this helps.