+ Start a Discussion
srinivasasarmahere1.390217033575374E12srinivasasarmahere1.390217033575374E12 

Batch Apex Class

Hello,

I have to write a batch apex class on two objects

1. Case 
2. Ticket__C

Ticket__c has a lookup to case and a case can have many ticket records but a ticket can only be associated to one case record

The Batch Apex class should run every morning at 2:00am and look at two fields(Status) in both the objects. Batch Apex shouls look at all the Cases and all the Tickets associated to the cases.

Case         -    Status (Field)
Ticket__c  -    GLOBAL_Ticket_Status__c (Field)

For example : if a case is associated with 3 Ticket__c records and the status of case is open, but status on 2 ticket__c records are closed and not the third record. Do not do anything.
If status of all the Ticket__c records are set to closed for a particular Case record but the Case record status itself is still open, Close the case after 7 days of Ticket__c records status closed. (This is because if business want to add a ticket to that particular case they can just because the case status is not closed).

Any help will be much appreciated


thank you
Phillip SouthernPhillip Southern
Hi, please post the code you have so far so we can troubleshoot.
srinivasasarmahere1.390217033575374E12srinivasasarmahere1.390217033575374E12
hi Phillip,

The only issue is i have never written batch apex class before and any guidence as to how to go about getting the code written is much appreciated