epa null

def paymentcycle = PaymentCycle_c def payperiod = PayPeriodID_c def paydate = PayDate_c def Badgeid = BadgeIDWorkerNumber_c // 1. Explicitly initialize EPA to null [cite: 131] def EPA = null def gettype if(IncentiveType_c == 'BONUS') { gettype = 'COMMISSION' } else if (IncentiveType_c == 'COMMISSION') { gettype = 'BONUS' } // 2. Ensure all required criteria are non-null before querying [cite: 132] if(IncentiveType_c != null && PayPeriodID_c && PayDate_c && BadgeIDWorkerNumber_c) { def vo = newView('MTQ_ICM_PPH_OBJ_c'); // Using dynamic string substitution for criteria [cite: 450, 451] vo.appendViewCriteria("IncentiveType_c='${gettype}' and PayPeriodID_c='${PayPeriodID_c}' and PayDate_c='${paydate}' and BadgeIDWorkerNumber_c='${Badgeid}'") vo.executeQuery() // 3. Use if(vo.hasNext()) if you only expect one record, or while() for multiple if(vo.hasNext()) { def row = vo.next() // This will assign the value from the field, even if that value is null EPA = row.ExpectedPaymentAmount_c } } // 4. Returns the value found, or the initial null if no record was found [cite: 367, 382] return EPA

Comments

Popular posts from this blog

dev7 from eror

EPA

Unified Currency Report- Krithika