row 4 script
// Field-Level Trigger on BBAction_c
// Trigger Name: BBAction_HoldBeginningBalance_AutoSet
// Trigger Type: After Field Changed
// Row 4 Condition:
// - Incentive Type = COMMISSION or BONUS
// - BBAction = Hold Beginning Balance (MAV_DIR_BB_ACTION_1007)
// - NO other conditions (HRStatus, Country, SalesRP, Consent, CED, BB are all null)
if (BBAction_c == 'MAV_DIR_BB_ACTION_1007') {
// Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF)
if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') {
// Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c
def reverseBB = -1 * (BeginningBalance_c ?: 0)
// Set MPAGenerated only if value is different (avoid validation threshold)
if (MPAGenerated != reverseBB) {
MPAGenerated = reverseBB
}
// Set MPAStatus_c to 'Auto approved'
if (MPAStatus_c != 'Auto approved') {
MPAStatus_c = 'Auto approved'
}
// Set RecoverableFlagV1_c to 'Y'
if (RecoverableFlagV1_c != 'Y') {
RecoverableFlagV1_c = 'Y'
}
}
}
Comments
Post a Comment