Guest User

Untitled

a guest
Apr 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // set<id> ListofClosedcase= new set<id>();
  2. //List<Case>CaseToUpdate=new List<Case>();
  3. List<Case>CaseToCreate=new List<Case>();
  4.  
  5. for(Case cs:newObjects)
  6. {
  7. system.debug('++cases:'+cs);
  8. if(cs.RecordTypeId==DigitalRecordTypeId && oldcases.get(cs.Id).status!=cs.status && cs.status=='Closed')
  9. {
  10. system.debug('@@@RecordType:'+cs.RecordTypeId);
  11. system.debug('@@@@status:'+cs.status);
  12.  
  13. if(cs.amount__c>=250)
  14. {
  15. system.debug('@@Balance:'+cs.AR_Balance__c);
  16. Case ct = new Case();
  17. ct.RecordTypeId = testrecordtypeid;
  18. ct.Account__c= cs.account.Name;
  19. ct.subject='testing';
  20. CaseToCreate.add(ct);
  21. system.debug('CaseToCreate:'+CaseToCreate);
  22. }
  23.  
  24. else if(cs.amount__c>=200 && cs.amount__c<=249)
  25. {
  26.  
  27. Case ct = new Case();
  28. ct.RecordTypeId = collRecordTypeId ;
  29. ct.status='New';
  30. ct.Account__c=cs.account.Name;
  31. ct.subject='testing';
  32. CaseToCreate.add(ct);
  33. }
  34. }
  35. }
  36. if(CaseToCreate.size()>0)
  37. {
  38. update CaseToCreate;
  39. system.debug('@@@@@@@@@@@@@@@@@'+CaseToCreate);
  40. }
  41.  
  42. }
Add Comment
Please, Sign In to add comment