0

Kindly suggest where the above said error is ( I am attempting to do it in Developer console) and its resolution. Here I am modifying a field FirstInstallmentAmt__c which is in Operation__c by a field in Payment_Details__r (Fees_Received__c) on a condition. Payment_Detail__c (Operation_Number__c is a look-Up field) is a child object of Operation__c.

 list<Operation__c> tempOp2 = new list<Operation__c>();
 list<Operation__c> tempOp3 = [Select id, name,FirstInstallmentAmt__c, 
                                (Select id, Operation_Number__c,Fees_Received__c
                                       from Payment_Details__r)
                                from Operation__c];
system.debug('=tempOp3--' + tempOp3);
for(Operation__c temp1 : tempOp3){
     for(Payment_Detail__c pd : temp1.Payment_Details__r){
         if(temp1.FirstInstallmentAmt__c == null &&
             pd.Fees_Received__c != null){
             temp1.FirstInstallmentAmt__c = pd.Fees_Received__c;
             tempOp2.add(temp1.FirstInstallmentAmt__c);
            system.debug('temp1.FirstInstallmentAmt__c--'+temp1.FirstInstallmentAmt__c);
       }
    }
}
update tempOp2;
2

tempOp2 is a List of Operation__c objects. You are trying to add a Decimal value into it:

 list<Operation__c> tempOp2 = new list<Operation__c>();
 ...
 tempOp2.add(temp1.FirstInstallmentAmt__c);
|improve this answer|||||
  • 1
    Thanks a lot BarCotter. It was a silly mistake from my side. – Rohit Dec 11 '14 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.