I've just had the "Manager Groups" option enabled by SFDC. I am now trying to build an "Appraisal" object so that the records in it are only viewable by the record owner and anyone directly in that user's management line, but no one else.

I've googled for a howto and the closest I got was this which isn't very helpful...

How do I set this up - I've been looking at a sharing rule, but it's not clear how to set this up?

  • I have since worked out that using manual sharing I can have a specific user make their private records viewable up their management line, but I'm looking for a way to enable this across the board, using a sharing rule on the object, rather than having every user manually share in this way.
    – Brad
    Commented Sep 27, 2014 at 11:08

3 Answers 3


By my understanding and experience of Salesforce Manager groups, this isn't possible to do "dynamically". i.e. there's no way to simply say "Share to current owner's Manager Group".

However, I have created an idea on the exchange here: https://success.salesforce.com/ideaView?id=08730000000Dkq0AAC


I recommend you look at the Force.com Workbook which walks you through examples of precisely what you need to do. Even if the Org Wide Default is set to private for that object, if "Grant Access Using Hierarchies" is enabled, then the owner's supervisor will be able to edit and modify the record as will the person in hierarchy above the record owner's supervisor. I believe those details are explained in Chap 7 of the above reference. The reference also explains sharing groups and how to set them up.

  • thanks -- I had set up Role Hierarchies and OWDs already, but upon reading that guide, I think my role hierarchies were not sufficiently granular -- so I'm rehashing these and I should be able to get it to work with Grant Access with Hierarchies... However, this doesn't answer the question about "Manager Groups" -- how might I use these?
    – Brad
    Commented Sep 27, 2014 at 19:31
  • Perhaps if you edited your question to restate the Manager Groups portion of it someone might be able to answer it. As stated now, I don't understand it in the context of the answer I've provided. Here's a link to the SF Help section on how to use Manager Groups: help.salesforce.com/… which may provide some further enlightenment. In essence, every user is linked to two manager groups. How helpful that is to what you want to accomplish isn't clear to me. Again, editing & rephrasing your questions would be recommended.
    – crmprogdev
    Commented Sep 27, 2014 at 20:41
  • I linked to that same help page in my original question!
    – Brad
    Commented Sep 29, 2014 at 19:14
  • My bad on the link. I still think you need to rephrase what you want to do with Manager groups as it doesn't appear to me that the problem you initially asked for a solution to is what Manager Groups are intended to do.
    – crmprogdev
    Commented Sep 29, 2014 at 19:44

While it's not as simple as you'd expect, you can share with management chain using a simple trigger:

trigger ClaimShare on Expense_Claim__c (after insert) {
    List<Expense_Claim__Share> shares  = new List<Expense_Claim__Share>();

    // Get Manager group related to the current user
    List<Group> managerGroup = [ select id from group where type='Manager' and RelatedId= :UserInfo.getUserId()];

    if (managerGroup.size()>0)
        for(Expense_Claim__c claim : trigger.new){
            Expense_Claim__Share newShare = new Expense_Claim__Share();
            newShare.ParentId = claim.Id;
            newShare.UserOrGroupId = managerGroup[0].Id;
            newShare.AccessLevel = 'edit';

        // Insert sharing records and capture save result 
        // The false parameter allows for partial processing if multiple records are passed 
        // into the operation 
        Database.SaveResult[] lsr = Database.insert(shares, false);

        Integer i=0;

        // Process the save results
        for(Database.SaveResult sr : lsr){
                // Get the first save result error
                Database.Error err = sr.getErrors()[0];

                // Check if the error is related to a trivial access level
                // Access levels equal or more permissive than the object's default 
                // access level are not allowed. 
                // These sharing records are not required and thus an insert exception is 
                // acceptable. 
                if(!(err.getStatusCode() == StatusCode.FIELD_FILTER_VALIDATION_EXCEPTION  
                     &&  err.getMessage().contains('AccessLevel'))){
                         // Throw an error when the error is not related to trivial access level.
                                 'Unable to grant sharing access due to following exception: '
                                 + err.getMessage());


This just a variant of: Sharing a Record Using Apex.

Don't forget to create the manual sharing reason on the object to share.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .