2

How can I create a report that based on the running user it will show how many users are below him in the Role Hierarchy? I need to show this in a report. If it's using Apex and Visualforce, how would you approach it?

1 Answer 1

1

If your Sharing Settings (Setup> Security Controls> Sharing Settings) are configured so the Default Internal Access for the User Object is Private, then a basic report on users will be sufficient (since it will only return Users that they are given access to).

However, if your settings are public, then you will need to approach this using APEX/Coding. I recommend makeing sure you evaluate the pros/cons of making your User object public to all Users.

3
  • User is private, but the requirement is a little more complex. Let's say I need to show the amount of Leads a team owns, the amount of users in that Role and the average of Leads per User. Taking into consideration that there are users that do not own Leads.
    – Leo
    Commented Nov 4, 2015 at 20:20
  • Yeah, you're getting into heavier stuff with that. I will tell you salesforce is not an amazing analytics tool for robust needs such as your. We have the same challenge, and my recommendation is to figure out how to get the data onto a SQL Server and run your calculations first (#Leads, Opps, Amount Sold, Tasks Created) by user, then either reference within salesofrce or publish your own reports. You can use batch apex to perform these calcs daily and load into a Custom Object (for reporting) if you prefer to keep all within salesforce, but be careful since your metrics will evolve.
    – James
    Commented Nov 5, 2015 at 17:19
  • Additional recommendation is to make a Dashboard which pulls various components. This way you can show # Leads -- # Opps -- # Tasks -- # Users. From here, your end users can use basic math to calculate the per/user piece.
    – James
    Commented Nov 5, 2015 at 17:21

You must log in to answer this question.

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