function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AgentDealerXAgentDealerX 

Batch Chaining Error

I'm having an issue with Batch Apex.  I have a batch class AutoAssignBatch and a scheduler class AutoAssignScheduler.  In the finish() method of the batch, under certain conditions, I schedule an AutoAssignScheduler job, which then executes another batch job.  The batch runs fine on the first run, but when it comes back around, it runs for a couple hours before giving me the error "All attempts to execute message failed, message was put on dead message queue."

 

Does anyone know what could be causing this?

 

Best Answer chosen by Admin (Salesforce Developers) 
AgentDealerXAgentDealerX

Thanks everyone for your quick responses!  Whatever the error was, I'm not having it anymore.  I'm not sure what caused it or fixed it, but it's gone.

All Answers

Shashikant SharmaShashikant Sharma

You cannot call the Database.executeBatch method from within any batch Apex method.                                                                Check out this : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm

Ankit AroraAnkit Arora

A very good link to serialize the batch class :

 

http://devendranatani.blogspot.com/2011/03/serialize-batch-apex-in-salesforce.html

 

 

Thanks
Ankit Arora

 

Ritesh AswaneyRitesh Aswaney

If you're after Batch Chaining, then the System.schedule in the finish of one batch can be used to schedule another batch job. However, keep in mind the limit on the max num of jobs which can be scheduled at a given time (reckon its 10)

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_system.htm#system_schedule_method

AgentDealerXAgentDealerX

Thanks everyone for your quick responses!  Whatever the error was, I'm not having it anymore.  I'm not sure what caused it or fixed it, but it's gone.

This was selected as the best answer
SFDC_kittySFDC_kitty

I don see any solution for this subject :\

Actually, i am now facing this error too.... any1 can give me some idea to solve this.... 

 

Best 

kitty!