One of the best parts for a Manager in Salesforce is the My Team’s list view, like you are able to see in Opportunities. Sadly, this doesn’t translate to Custom Objects, so it is not as “easy” to select My Team’s, in this case a custom Project object, Projects. Luckily, you can use Roles to help achieve this result!
Roles grant visibility through the Hierarchy. It’s not uncommon to see a Role Hierarchy that looks something like below.
Although this does show the Hierarchy in a way that is easily readable, it doesn’t help achieve a My Team’s List View. Below is what the Hierarchy should look like instead, and then below the picture will be the explanation to how it works.
If you look at the DF role, it stands for Developing Flow. This is the highest Role in the Hierarchy. If you were to look at the Role itself, you’ll see that on reports it still shows CEO.
When you continue down the Hierarchy, take a look at DF-SVP-VP-D-E and DF-SVP-VP-D-E-AE. You’ll notice that DF-SVP-VP-D-E fits inside DF-SVP-VP-D-E-AE. As a result, we can create a formula to say that DF-SVP-VP-D-E-AE is part of the DF-SVP-VP-D-E team because DF-SVP-VP-D-E-AE contains DF-SVP-VP-D-E. The two formulas below, first is My Team’s and second is My and My Team’s, allow you to create a formula field on any Object where you want to add a My Team’s List View.
This formula makes sure that the Owner doesn’t see the records for people in the same Role.
My and My Team’s
This formula marks the record as True if the Owner is the User as well.
So, how does this work with the List View? Just set the My Team to True!
And viola! You have a My Team’s List View!
Notice how the logged in User is Rich Englhard and the Owner is Test User. This is because Test User is under Rich Englhard in the Role Hierarchy. Role Hierarchy to the rescue!
3 thoughts on “Creating a My Team’s List View on a Custom Object using Roles”
I have tried My Team’s Lead view on Lead object. I have given Sales_manager and Sales-executive role hierarchy in org and also created checkbox on Lead object. But i didn’t get records under view. I am not getting where i have done mistake.
Thanks! I tried the formula but I have the following error message: Error: You don’t need to specify an object type for the Owner field. Remove User from your formula.
Can you please help?
I got the same error, you just need to change de “:” of the first CONTAINS to “.”
Check out the formula below:
ONTAINS( Owner.UserRole.Name , $UserRole.Name) && (( Owner.UserRole.Name != $UserRole.Name && OwnerId != $User.Id ) || (OwnerId == $User.Id))