0

We want to do call to batch apex from trigger. And in that batch apex class we want to do callouts. So we are giving batch size 50 in scope parameter. but we have more that 2K records which we update in bulk. And in one link they have said that we can only have 5 jobs running at a time. Image So is that possible to call batch apex class from trigger for more that 2K records in bulk. Please help us and give us a advice ASAP.

1
0

Use Queueable instead of Batchable for anything you want to do in a trigger. These have much higher limits per transaction (50), and can do pretty much everything a batch can do, except automatically handle millions of records. What you can do from there is pass in all 200 records into the queueable, and it can chain itself repeatedly to make the 200 callouts (e.g. you could chain 4 times to handle 50 callouts per iteration).

Also note that the normal API limit for records is 200, so if you upload 2k records "at once", there's actually 10 API calls, each with their own governor limits. The only time you need to worry about more than 200 records is when you're using Apex, since you can theoretically update many thousands of records that all share the same governor limits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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