Manager Group Overview
Salesforce introduced Manager Group in winter '14 and is automatically available from spring '15 for every org.
Manager Groups are used for sharing records with the management hierarchy.
Using Manager Groups, one can share records via manual sharing, sharing rules, and Apex managed sharing. Apex sharing reasons is not supported.
Manager Group Activation
For activation of manager group feature in your org
Go To Setup > Security Controls > Sharing Setting > Manager Group
Check the Manager Group check box.
This activates the Manager Group feature in your org.
Manager Group in Detail
Every user has two manager groups.
1. Managers Group: User's direct and indirect managers
2. Manager Subordinates Group: User and his direct and indirect reports
To find out who a user’s manager is, from Setup , click Manage Users > Users. Click a user’s name. The Manager Field on the user detail page displays the user’s manager.
So internally what salesforce does is, It defines two more types in Group Object .(you can read more about Group object here). These groups are read only groups which salesforce creates internally. For a Manager, Group type name is "Manager" and for Manager Subordinates Group type name is "ManagerAndSubordinatesInternal".
Role hierarchy and Manager Group
Now we will see the difference between sharing with Role hierarchy and Manager Group.
In the above hierarchy,
-
User B is the direct manager of User D and E
-
User C is the direct manager of F
-
User B and C are in same level in Role hierarchy with same role.
In the case of role hierarchy based sharing, User B and C get access of records of Users D, E, F because they are in same role as Manager.
But if somebody has to give access only to User D and E i.e. direct manager or in manager hierarchy users.
So for this situation manager group is the best solution and salesforce internally creates group for Manager Group as follows.
-
For User B - Manager group contains only user A .
-
For User B - Manager Subordinate Group contains User D and E.
-
For User D - Manager Group contains user B and A
In this way all groups are created internally. Hence with the use of manager group you can easily share records with management chain.
For ex.
By querying, you can easily get Id from the group like
Select Id, DeveloperName, Email, Name, OwnerId, Type, RelatedId from Group where Type='Manager' OR Type='ManagerAndSubordinatesInternal';
And then use it in apex sharing.
User B is the direct manager of User D and E
User C is the direct manager of F
User B and C are in same level in Role hierarchy with same role.
So for this situation manager group is the best solution and salesforce internally creates group for Manager Group as follows.
- For User B - Manager group contains only user A .
- For User B - Manager Subordinate Group contains User D and E.
- For User D - Manager Group contains user B and A
By querying, you can easily get Id from the group like
Comments
Post a Comment