Custom Cascade Condition
This section contains sample code for the custom cascade condition.
import com.workbrain2.ta.publ.api.entitlements.BalanceCascadeConditionScriptable
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 CustomBalanceCascadeCondition extends BalanceCascadeConditionScriptable{
EmployeeCtxPublService employeeCtxPublService = TARulesPublicServiceAccess.getEmployeeCtxService()
@Override
boolean evaluateCondition(RCContext context, String applyOnUnit, String applyOnValue) {
// evaluate balance cascade based on flag
String flag = employeeCtxPublService.getEmployeeData(context).getFlag7()
if (flag == null){
return false
}
else if (flag.equals("Y")){
return true
} else {
return false
}
}
}