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
OcoBriOcoBri 

Nested Allocations

Hello,

I'm not sure how to set this up.

I have a custom Allocation object with fields for Cost Center, Effective Date, and Percentage.

An Employee could be 50% Dept A, 50% Dept B.


This part is fine.

However, there are now nested allocations, wherein a Cost Center could be a basket ("Basket 1") of 25% Dept A, 75% Dept B.  
An an employee could be 50% Dept C, 50% Basket 1, which should evaluate to 50% C, 12.5% A, 37.5% B.
And the ratios in the Basket could change every quarter.

How can I set this up?  
I was thinking of using a Custom Setting to store the percentages within the baskets, but not sure how that would work in practice.

I'm not even sure what to Google for.

Any help would be appreciated.

Thank you,
Brian
 
Jason Reiber [ACS]Jason Reiber [ACS]
Brian,

I can't think of any good way to do this other than to buid a custom interface for assigning allocations to an employee via visualforce/apex.

So here's what I'm thinking....

1.) Create another custom object to capture the "basket" configurations so that they are easily accessible and can be easily changed.  The custom object might look a lot like the Allocation object, it really only needs to capture which cost centers and their respective %'s for the basket.
2.) Create a visualforce page to assign the allocations to an employee.  The page should allow the user to select the employee and one or more allocations to make.  Within the allocation selection they could choose either individual cost centers or a basket.  The Apex code could then cycle through the allocation selections that were made and create the Allocation instance assignments to the actual employee record.  During the loop of evaluating the allocation selections if it encounters a basket as an assignment then it will lookup the breakout of cost center allocations from that basket and enter a sub-loop to create individual Allocation assignments to the employee based on that, weighted to the basket assignment . For example, if basket 1 is selected for 50% then it will go look and see that basket 1 really is CC-A at 50% and CC-B at 50%, then when it's creating the individual Allocation assignments it will multiple each of the sub-loop cost center assignments by .5 (basket 1's selection).

I don't think this would be all that complex to build, but you'd need to be somewhat comfortable with VF/Apex.  Hope this helps!
Jason Reiber [ACS]Jason Reiber [ACS]
Forgot to mention that you'd also want to create a custom button that routes to the VF page for the purposes of creating a new Allocation, instead of using the standard New button.