Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

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.

share|improve this answer

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

share|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

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

share|improve this answer
Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. – Boris Bachovski Aug 13 '14 at 6:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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