• CodeStreetDev
  • 0 Points
  • Member since 2008

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

Hi All,


Getting quite frustrated with trying to find a solution for this issue.


Using Batch Apex and it is intermittently working correctly.


I have raised a case #03007660 ... however lucky me has had it assigned to someone out of office (that's the email reply I got anyway).


See my code below.


I have tried and tested it with batches of up to 327 records and it has worked successfully. However now trying to test with larger batches of >3000 records all I get is a debug log that says see below. And my Apex Jobs log just says..


Job Type = Batch Apex

Status = Completed

Total Batches = 0

Batches Processed = 0

Failures = 0


Essentially nothing happens. No error no real message nothing. Any help would be much appreciated here, I've seen a few other posts with similar issues, however this is getting critical for me to find a solution! 


I have also tried 'chunking' the batches at varying intervals all the way from 25 - 200 in the 'execute' method, without any success and also as another post suggested added a 'limit' to my query which also didn't help.


SOQL locator query with 3324 rows finished in 608 msCumulative resource usage:Total email recipients queued to be sent : 0Stack frame variables and sizes:  Frame0


global class PaymentCreate implements Database.Batchable<SObject>{// Creates and Processes Payments
public date PSBD;
public String PSID;
public String PSM;
Public String query;
global database.querylocator start(Database.BatchableContext BC){
  return Database.getQueryLocator(query);

global void execute(Database.BatchableContext BC, Sobject[] scope){
  List<AcctPayments__c> PaymentHolder = new List<AcctPayments__c>();
  List<Recurring_Payment__c> batchRP = new List<Recurring_Payment__c>();
  for(sobject s : scope){
    Recurring_Payment__c p = (Recurring_Payment__c)s;
    PaymentHolder.add(new AcctPayments__c(Payment_Session__c = PSID, Contact__c = p._Contact__c, Payment_Total__c = p.Recurring_Amount__c, Auto_Allocate__c = true, Payment_Method__c = PSM, RP_ID__c = p.Id, RP__c = p.Id, Recurring_Payment_Processed__c = true));
    p.MEMforce__Last_Processed__c = PSBD;
  insert PaymentHolder;
  update batchRP;

global void finish(Database.BatchableContext BC){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSenderDisplayName('Batch Processing - Payments Updated (Loaded and Processed)');
mail.setSubject('Batch Process Completed - Payments Updated (Loaded and Processed)');
mail.setPlainTextBody('Batch Process has completed - Payment Updated (Loaded and Processed)');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
     loading.query= myQuery;     loading.PSID = thisPS.Id;
     loading.PSBD= thisPS.Banking_Date__c;
     loading.PSM = thisPS.Payment_Method__c;
     ID batchprocessid = Database.executeBatch(loading, 50);
Message Edited by Patrick Bulacz on 10-15-2009 09:36 PM