Rounding in Time Off is a bit complex and sometime, getting precise result is difficult. In this article I will discuss about a scenario of rounding Leave Accrual to next multiple of 0.5. For example, while calculation of Leave Accrual if result is 1.2, it should be rounding to 1.5 and if value is 1.6, it should be rounding to 2.
To achieve above requirement, I have tried an alternate method. I will describe it in following steps –
- Create a new Custom Object (Say accrualRound) with following fields –
- Create a data file where data in columns were having a difference of 0.5(as per my requirement). Screenshot is shown below –
- In my accrual rule I have written following logic –
Whenever above Accrual Rule will be execute, at time of Time Account Creation, it will check the lookup table and pick up the correct Rounding value.
Eg. Before Time Account creation, if variable amount is (suppose) 2.67, Rule will read the lookup table and pick round to value from fifth row i.e. 3.
Hope this solution will help you in rounding of Accrual.