Skip to main content
added 240 characters in body
Source Link
Phil Hawthorn
  • 16.8k
  • 4
  • 49
  • 76

When run in Batch, you can only enqueue 1 job per execution of the batch so if your batch is causing the Trigger to enqueue more than 1, it will fail as described. I'll try to find a link to the docs describing this.

If your trigger is firing, from a batch apex process, and you have 2 Triggers firing that both enqueue a job, you will get the error because both the triggers fire in the same execution context (even though they are separate triggers).

For example:

Batch Apex
    Insert record(s)
        Trigger 1 (enqueue job 1 - ok)
        Trigger 2 (enqueue job 2 - fail)

The only way to get around that would be to ensure that only one enqueue job gets called across all triggers that fire.

When run in Batch, you can only enqueue 1 job per execution of the batch so if your batch is causing the Trigger to enqueue more than 1, it will fail as described. I'll try to find a link to the docs describing this.

When run in Batch, you can only enqueue 1 job per execution of the batch so if your batch is causing the Trigger to enqueue more than 1, it will fail as described. I'll try to find a link to the docs describing this.

If your trigger is firing, from a batch apex process, and you have 2 Triggers firing that both enqueue a job, you will get the error because both the triggers fire in the same execution context (even though they are separate triggers).

For example:

Batch Apex
    Insert record(s)
        Trigger 1 (enqueue job 1 - ok)
        Trigger 2 (enqueue job 2 - fail)

The only way to get around that would be to ensure that only one enqueue job gets called across all triggers that fire.

Source Link
Phil Hawthorn
  • 16.8k
  • 4
  • 49
  • 76

When run in Batch, you can only enqueue 1 job per execution of the batch so if your batch is causing the Trigger to enqueue more than 1, it will fail as described. I'll try to find a link to the docs describing this.