Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Thanks for replying! enqueueJob is only being called in the after insert scope of the trigger. Also, the logic in the Queueable doesn't modify the events, it launchs a WebService. My question is: every batch calling the enqueueJob is considered as same transaction, even if they are in different SerialBatchs? Commented Feb 8, 2018 at 10:30
  • We would need to see a bit more code to understand where is your problem. Try to turn on your debug log, and before system.enqueueJob, add System.debug('Enqueue Limit : '+Limits.getQueueableJobs()); Commented Feb 8, 2018 at 10:36
  • Each execute batch is a separated transaction. Commented Feb 8, 2018 at 10:37
  • Ok, so what if I create a Batch for inserting the Events (>800k), and instead of calling the Queueable from the trigger, I call it from the finish method within the Batchable class? If I understood you properly, and every execute is a separated transaction, so it will be every finish, right? Then, I'd be able to .enqueueJob from there. Commented Feb 8, 2018 at 11:16
  • 1
    How can I achieve this?:Make sure you don't call enqueueJob twice at any point in the same transaction. For example an insert that would call an update and would execute enqueueJob twice. Commented Jun 10, 2021 at 13:33