fixed
// 1. Check the primary action code
if (BBActionManual_c == 'MAV_DIR_BB_ACTION_1011') {
// 2. Check the Incentive Type
if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') {
// Use a safe null check for CED_c
def cedValue = CED_c ?: 0
// Define the two valid scenarios for clarity
boolean isValidTerminated = (HRStatus_c == 'T' && EmploymentCountry_c != 'RO' && SalesRP_c == 'Y' && cedValue < 0)
boolean isValidActive = (HRStatus_c == 'A' && EmploymentCountry_c != 'RO' && SalesRP_c == 'N' && cedValue < 0)
// 3. If it matches NEITHER valid scenario, throw the exception
if (!(isValidTerminated || isValidActive)) {
throw new oracle.jbo.ValidationException("Not a Valid combination for Payroll collection.")
}
}
}
Comments
Post a Comment