Custom Balance Transfer Condition

This section contains sample code for the custom balance transfer condition.


import com.workbrain2.ta.publ.api.entitlements.BalanceTransferConditionScriptable
import com.workbrain2.ta.publ.api.rules.RCContext
import com.workbrain2.ta.publ.api.rules.TARulesPublicServiceAccess
import com.workbrain2.ta.publ.api.rules.ctx.EmployeeCtxPublService

class CustomBalanceTransferCondition extends BalanceTransferConditionScriptable{

    EmployeeCtxPublService employeeCtxPublService = TARulesPublicServiceAccess.getEmployeeCtxService()

    @Override
    boolean evaluateCondition(RCContext context, String applyOnUnit, String applyOnValue) {
        // apply balance transfer based on value from Flag
        String value = employeeCtxPublService.getEmployeeData(context).getFlag1()
        if (value == "Y"){
            return true
        } else {
            return false
        }
    }
}