• StenEbenau
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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