employee consent validation rule
// 1. Identify the specific business scenarios
def is1011 = (BBActionManual_c == 'MAV_DIR_BB_ACTION_1011' &&
HRStatus_c == 'A' &&
EmploymentCountry_c != 'RO' &&
SalesRP_c == 'N' &&
CED_c <= 0 &&
(IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS'))
def is1012 = (BBActionManual_c == 'MAV_DIR_BB_ACTION_1012' &&
IncentiveType_c == 'BONUS' &&
HRStatus_c == 'A' &&
SalesRP_c == 'A' &&
CED_c <= 0)
// 2. Case: Mandatory Check Required
if (is1011 && EmployeeConsent_c != 'Y') {
throw new oracle.jbo.ValidationException("MPA to Payroll Collections requires manual acknowledgement. Please check Employee Consent.")
}
if (is1012 && EmployeeConsent_c != 'Y') {
throw new oracle.jbo.ValidationException("SPIF vs Comm deduction requires manual acknowledgement. Please check Employee Consent.")
}
// 3. Case: Restricted (User tried to check it when conditions aren't met)
// This is the "Fail-Safe" that prevents the second-save bypass
if (!is1011 && !is1012 && EmployeeConsent_c == 'Y') {
throw new oracle.jbo.ValidationException("Employee Consent is not applicable for this record configuration. Please uncheck the box to save.")
}
return true
Comments
Post a Comment