Technical Articles
Accrual Calculation based on age limit for each child or dependent
Hello Everyone
This is regarding calculating accruals based on dependent age. I have seen many such questions floating around the customer and partner community. Hence wanted to share a possible solution for now.
Let’s look at a sample requirement “A customer’s requirement is, that Vacation days are added for each child under 12 years of age”. For example, if there are 3 children and only 2 are below 12 years, the accrual should be 20 (2 * 10 days per child). “
We have two ways of handling this. You can follow the approach you like
Option 1: Using Custom field and Integration Center
Coming to this solution, you can follow the below steps and check the results yourself. Further, you can adapt
Procedure
1. Create a custom field in Dependents “IsEligibleForAccrual” using BCUI.
2. Create a new on Save rule on the same dependent portlet to set this custom field based on your requirement of 12 years (144 months)
3. In the accrual rule use the cardinality rule function to check the number of dependents matching this field as “YES”
Testing
The current employee has two eligible dependent Childs
In my sample rule, I am providing 10 days per dependent matching the criteria
The accrual granted is 20 days which is correct in this case
Integration Center to update dependents in subsequent years
The eligibility of existing dependents which were added after the employee is hired can change in subsequent years. For example, If there is a child born in 2008 would become 13 years in 2021. As a result, at beginning of 2021, we need to update this eligibility field to “NO” so that the accruals for 2021 can consider this
To achieve this consider the below design
Create a outbound integration to output the current dependents in system into a csv file in SFTP folder
Example:
Add a calculated field named “Years” and add the following calculation
This gives the difference between the date of birth of dependent and today (Jan 1st of every year)
Sample file extracted
Create an inbound integration to read the csv file (exported in above step) from SFTP folder
Map the fields Person ID External , Related Person ID External
Make Start date as calculated field which is resolved to today or NOW
Also make the isEligibleForAccrual as calculated field with below calculation by using “Choose” Operator
It is a switch case where if the Years field from CSV is between 1 to 12 , it will be set to YES
Otherwise NO
Small Test
After I run the integration centre report, the dependent who is now 13 years in 2021 is updated
You can schedule these integrations every year (Beginning of Jan) if your accrual calendar year is Jan – Dec. This would ensure that the dependent’s eligibility is set as per their age at that moment.
Post this, you can run the accrual calendars for this time account type
Other considerations
- Instead of years if you want months, you need to add numbers from 1 to 144 in your switch case, as in IC the if else condition does not provide filters less than currently
- You can add additional time based filters to prevent reading all dependents. This can depend on your use case
Option 2:
You can use the below rule and rule function to check if a child is less than 15 years or 180 months as of accrual date
What this rule does? It basically sorts the employee’s dependents with relationship child (external code =2) as per their DOB. And it checks the position/rank of the first child meeting the criteria of less than <= 180 months. . For example say there are 5 children and the first child meeting the criteria of<=180 months is at rank 3, this means the first 2 children are above>= 180 months and all children below 3rd position i.e child 4 and 5 are <=180 months. So in total, we have 5-2 = 3 children meeting these criteria. Hence you can then use this number 3 to further calculate the accruals
This is a simpler way instead of option 1. Further, the rule is limited to only 3 children in the picture but you can extend it to any number of children. Just continue the pattern and logic
Disclaimer:
The current solution does not cover accrual recalculation for ex: when a new eligible child is added. But such challenges can be overcome by scheduling periodically the time off calendars.
If I get a way to automate this step as well, Will enhance this blog or create a new one.
Also please evaluate this with your customer, before adopting the solution.
Thanks
Neelesh
Nice blog Neelesh Kamath and I have a small query on Treat Null As() function you used TREAT NULL AS() function because to avoid inconsistency if there are no YES records in the system, correct me if I’m wrong.
Considering your example there are 2 YES records, so first system checks whether there are none of YES records maintained and if none YES records exist then rule will update the VALUE with 0; when multiply any number with 0 will be 0 so no output and if YES records are maintained then the VALUE will be 2( based on example) and Factor is 10 so output will be 2*10=20.
My Query is what happens if we directly use Cardinality function in VALUE field, will system throw error or Accruals will generate with different value?
Thanks,
Parthu.
HI Parthu
Thanks for the feedback. I generally use Treat Null As with all these functions as some return NULL and some a numeric value. Hence Do not want the rule to fail because of an unhandled null case.. But I guess for Cardinality you can make use of the function directly on the value as it is numeric.
Please give it a try
Thanks
Neelesh
Hi Neelesh,
thanks for the information you shared, I am just facing this situation. About that, I have a couple of questions about the process you follow.
If the rule is an onSave trigger scenario, then this information is going to be useful just one time. I mean:
Additionally, I do not get the point of calculating eligibility based on dependent's date of birth and event date, I would calculate eligibility based on date of birth and today, to determine age and this would let me calculate eligibility.
Thanks for your time and effort to share knowledge.
Best regards,
Isra
Hi Isra
Regarding your comments
Additionally, I do not get the point of calculating eligibility based on dependent’s date of birth and event date, I would calculate eligibility based on date of birth and today, to determine age and this would let me calculate eligibility. – yes you are right. I just created a POC and tested with event date = today. Practically Today makes sense.
Thanks & BR
Neelesh
Hi Neelesh,
On the second option did you use new custom object Sub Quota for Vacation per Employee SVN?
Regards,
Fuad
Hi Fuad,
Yes I used a custom MDF in my implementation for different reasons but you can use this rule function directly in accrual rule as well and use else if to create different accrual values based on conditions
Regards
Neelesh