Guest User

Untitled

a guest
Apr 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. for(Case cs:newObjects)
  2. {
  3. if(cs.RecordTypeId==retiredRecordType && cs.status=='Closed')
  4. {
  5.  
  6. expired.add(cs.id);
  7.  
  8. }
  9.  
  10. }
  11.  
  12. update =[select id, AR_Balance__c, Accountid,status from Case where id in:expired];
  13. for(Case c:update)
  14. {
  15. if(c.amount>=250)
  16. {
  17.  
  18. Case ct = new Case();
  19. ct.RecordTypeId = expiredRecordType;
  20. ct.status='New';
  21. ct.id=c.accountid;
  22. ct.subject='testing';
  23. CaseToCreate.add(ct);
  24. }
  25.  
  26. else if(c.amount<200 )
  27. {
  28.  
  29. Case ct = new Case();
  30. ct.RecordTypeId = liveRecordType;
  31. ct.status='New';
  32. ct.accountid=c.accountid;
  33.  
  34. ct.subject='testing';
  35. ToCreate.add(ct);
  36. }
  37. }
  38.  
  39. if(ToCreate.size()>0)
  40. {
  41. insert ToCreate;
  42. }
  43.  
  44. }
Add Comment
Please, Sign In to add comment