Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. If(invcIds.size()>0){
  2.  
  3. List<AggregateResult> ar = [Select invoiceit_s__Invoice__c invId, MAX(invoiceit_s__Payment_Date__c) pymntdt From invoiceit_s__Payment_Plan_Installment__c Where invoiceit_s__Invoice__c IN:invcIds Group By invoiceit_s__Invoice__c ];
  4. for (AggregateResult a : ar){
  5. invcIddate.put((Id)a.get('invId'),(Date)a.get('pymntdt'));
  6. }
  7. system.debug('invcIddate'+invcIddate);
  8. for(invoiceit_s__Invoice__c inv : trigger.new) {
  9.  
  10. if(invcIddate.size()>0 && invcIddate.containskey(inv.id)){
  11. inv.Final_Payment_Date__c = invcIddate.get(inv.id);
  12. }
  13.  
  14. }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement