employeeconsentvalidation
// 1. Define the business scenarios
def isScenario1011 = (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 isScenario1012 = (BBActionManual_c == 'MAV_DIR_BB_ACTION_1012' &&
IncentiveType_c == 'BONUS' &&
HRStatus_c == 'A' &&
SalesRP_c == 'A' &&
CED_c <= 0)
// 2. MANDATORY CHECK: If either scenario is met, Consent MUST be checked
if (isScenario1011 || isScenario1012) {
// Assuming 'Y' is the value for checked. Change to true if it's a Boolean type.
if (EmployeeConsent_c != 'Y') {
throw new oracle.jbo.ValidationException("Employee Consent must be selected for the current Action and Incentive type.")
}
}
// 3. RESTRICTION: If the user tries to change consent outside of these scenarios, block it
if (isAttributeChanged('EmployeeConsent_c') && !(isScenario1011 || isScenario1012)) {
throw new oracle.jbo.ValidationException("Employee Consent cannot be modified for this record configuration.")
}
Comments
Post a Comment