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
Pinnacle-AaronPinnacle-Aaron 

System.AsyncException: Database.executeBatch cannot be called from a batch or future method

I'm fairly new to Apex development and have a question on triggers and batch processes.

 

I have an AFTER INSERT trigger on Object A that executes a batch process, say, Batch 1.

 

Batch 1 builds an Object B record and inserts it.

 

Object B has an AFTER INSERT trigger that executes a batch process, say, Batch 2.

 

Batch 2 builds an Object C record and inserts it.

 

I'm receiving a "System.AsyncException: Database.executeBatch cannot be called from a batch or future method." error on Batch 2.

 

I'm assuming this is because Batch 1 hasn't completed before Batch 2 fires off?

 

Thanks,

Aaron

PatcsPatcs

we are also facing the same problem,if any one knows the solution pls help..........

StenEbenauStenEbenau

Hmm, i have the same problem. How did you guys solved this problem?