Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(Case cs:newObjects)
- {
- if(cs.RecordTypeId==retiredRecordType && cs.status=='Closed')
- {
- expired.add(cs.id);
- }
- }
- update =[select id, AR_Balance__c, Accountid,status from Case where id in:expired];
- for(Case c:update)
- {
- if(c.amount>=250)
- {
- Case ct = new Case();
- ct.RecordTypeId = expiredRecordType;
- ct.status='New';
- ct.id=c.accountid;
- ct.subject='testing';
- CaseToCreate.add(ct);
- }
- else if(c.amount<200 )
- {
- Case ct = new Case();
- ct.RecordTypeId = liveRecordType;
- ct.status='New';
- ct.accountid=c.accountid;
- ct.subject='testing';
- ToCreate.add(ct);
- }
- }
- if(ToCreate.size()>0)
- {
- insert ToCreate;
- }
- }
Add Comment
Please, Sign In to add comment