4

I am getting the below exception when I am running batches in sequence. That is, I am calling another method to create next batch once the first batch is in it's finish method.

Database.executeBatch cannot be called from a batch start, batch execute, or future method.

I am sure we are using latest version of the Batchable interface.

Any help would be appreciated. Thanks in advance!

1

Most likely problem is the Salesforce API version that the Batchable class is set to. That needs to be >= 27 for the batch chaining from the finish method to work.

|improve this answer|||||
1

Hey It works only in API version 27. Change API version to 27. Will work for you. :)

|improve this answer|||||
  • Interesting. Do you have any proof/link to official docs about that? I have 1 batch starting out of finish() method of another and it works like a charm (API v 23) – eyescream Aug 11 '14 at 6:11
0

I have changed the version to 26 and it worked :) It was initially 25 fyi.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.