function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ek KanusEk Kanus 

How to Store data as per role Hierarchy and hierarchical Rollup

I Need to Store Number fields per used based on User role Hierarchy and need to do hierarchical Rollup later on once data is updated. Did anyone tried to do this in Salesforce.

One Approach I am thinking is store it on user record but not sure if there any way to auto rollup this data. Wanted to check what will be best data model for this.

 

Note: I am aware if forecasting in Salesforce, which is not going to work in this scenario.

 

Please find below is the sample data - 

 

  • VP - 3000
  • ----Mgr - 2000
  • -----------Sales Rep - 1000
  • -----------Sales Rep - 1000
  • ------Mgr - 1000
  • -----------Sales Rep - 1000
Peter_sfdcPeter_sfdc

You could try it with a formula field on user like this: 

CASE(UserRole.DeveloperName ,
   'VP','3000',
   'East_Manager','2000',
   'West_Manager','2000',
   'West_Rep','1000',
   'East_Rep','1000',
   '0000')

Ok...if you have 1000 roles, it won't fly, but if it is a relatively small to moderate number, this would give you what you want. The reason I chose developer name incidentally is because that will give you some flexibility to rename the roles, allowing the user to see something different, without necessarily having to change the formula. 

 

I've also randomly picked 0000 as the default value. This would allow you to run a report, and if any users show up with the 0000 value in the field, you'd know that something has changed that spoils the outcome of the formula and you can fix it. 

 

Good luck!