Hello Everyone,
We have seen this requirement in most of the cases where business allow users to carry over specific number of leaves to the next year and employees can use those leaves only in first 3 months or maybe first 6 months.
There are multiple ways how this can be done using Interim rule or Business Rules but today I am going to show you the process which will take care of carrying balance over to next year automatically at the end of current year and will restrict users to take these leaves only for First 3 months in next year. All this will happen using custom Integration and no need to run Interim rules or rely on any another business rule.
Here is my business case
Step 1 – Create Custom field on Time Account “Balance as of PEP” where we can store the balance which needs to be carried over to next year
Go to Configure Object Definition, Select Time Account as object and create a custom field
The field should be of Decimal type which will allow us to store the balance from current year in this field
Step 2 – Create Time Account Type “Annual Leave” which will be regular Time Account Type assigned to Leave and it will Post leaves on year to year basis.
Time Account Type Settings
Hire Rule – Here we are allotting 25 Laves to employee at the time of hiring without Proration
Termination Rule – We are calculating balance as of Accruable End Date and posting it on Accruable End Date. It means that at the time of Termination there will be no Proration
Accrual Rule – We are giving 25 Leaves to employees at the start of the year
PEP Rule – For this Time Account Type we are posting Minimum of 10 or Remaining Balance of old account into custom field. Then we are simply making balance zero on Time Account and closing the account
Step 3 – Create Time Account Type “Annual Leave (Carried Over)” which will be created using Integration Center and account created using this rule will be only active for first 3 months of the year.
Time Account Type Settings for Second Time Account Type
PEP Rule – In this PEP rule we will simply close the Time Account and balance will be made zero before closing the Time Account
Step 4 – Create Time Type “Annual Leave” For Singapore and attach both the “Time Account Type” which will allow us to carry over balance on same “Time Type.”
Time Type Settings
Assignment of both Time Account Types to Time Type
Step 5 – Lets create Integration which will carry over Balance from Last year’s Time Account to next year’s Time Account.
Use Above settings to create Integration
Select Time Account as starting Entity
This is how Configure Field should look like. On Left side we will select the Time Account From current year from which balance will be carried over. On Right side we will create Time Account for Next Year in which balance will be Carried over
Mapping can be done as below
Current Year Time Account (Left Side) | Future Year Time Account (Right Side) | Mapping Type | Comments |
External Code | Calculated Field | Use any logic to create custom external code for Time Account. I have used logic as “Employee Number + Bookable End Date From last year” | |
Closed | Default Value | False | |
Time Account Type | Default Value |
SGP_ANNUAL_LEAVE_CO This can be different for each country and then we can use calculated field in that case |
|
Booking Possible Until | Booking Possible Until | Calculated Field | Booking Possible Until + 3 Months |
Booking Possible Until | Booking Possible From | Calculated Field | Booking Possible Until + 1 day |
Booking Possible Until | Account Valid Until | Calculated Field | Booking Possible Until + 3 Months |
Booking Possible Until | Account Valid From | Calculated Field | Booking Possible Until + 1 day |
User | User | Direct Mapping | |
Time Account_External Code | Calculated Field | Use any logic to create custom external code for Time Account. I have used logic as “Employee Number + Bookable End Date From last year” | |
External Code | Calculated Field | Use any logic to create custom external code for Time Account. I have used logic as “Employee Number + Bookable End Date From last year” | |
Balance as of PEP | Amount Posted | Direct Mapping | |
Booking Possible Until | Posting Date | Calculated Field | Booking Possible Until + 1 day |
Posting Type | Default Value | MANUAL_ADJUSTMENT | |
Posting Unit | Default Value | DAYS | |
Comment | Default Value | Carried over Balance From Last Year |
We need to use filter combination as above. This will only select the Time Account Types which are of code “SGP_ANNUAL_LEAVE” and they are closed also Balance as of PEP is not equal to blank. Also Time Based Filter will allow to only pick records which are modified since last successful run.
Integration is scheduled to run only once a year on 1st Jan of every year
Step 6 – Time to Test Solution
Step 6.1 – Assign Time Profile to any Singapore Employee to see if the correct Leaves are assigned are not
For Demo Purpose I am using above Time Profile
My Test Employee is hired in 2023 and I have assigned newly create Time Profile to Employee to check if regular Leave Balance is getting assigned Properly
As expected Correct Number of Leaves are assigned to Employee
Step 6.2 – Run Period End Processing manually to Check status of Time Account
Time Account Before Period End Processing
Period End Processing Calendar
Time Account After Period End Processing. Here you can see the custom field now has value as 10 and account is closed.
Details of PEP which shows complete Balance is lapsed and made 0
Step 6.3 – Running Integration Manually for Test Purpose
Integration Picked up this record as it matches all the condition
After Successful run of Integration you can see that new Time Account got created for employee. This time account will get closed automatically now after 3 months of next year and because of PEP rule the leaves will get lapsed
Details of Time Account showing Balance which got carried over from Last Year
Here we can see old Time Account getting closed with Period End Processing
We can also see the New Time Account has future posting on 1st Jan which means leaves will get carried over on that day and will be usable for 3 months
Hope this solution will help you to achieve your specific requirement
Benefits of using above solution
Thank you for taking time and going through my blog!