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
ClaiborneClaiborne 

SendEmail Limits in Batch Process

I have a batch process that sends a case summary report to a special set of clients. Because the report is rather complicated - open cases, closed cases, pending cases with links to the self-service portal - , and each  company has several people who receive the report, I execute the report via a batch job that processes each company as a separate batch. This works fine as no company has more than 10 recipients, and each batch stays under the 10 sendEmail limit.

 

But when I try to run the same via Scheduled Apex, it stops as soon as the total number of emails in all batches reaches the 10-email limit.

 

Why is the limit processed differently when the process is kicked off manually and when the process is kicked off as scheduled Apex?

 

Any help would be greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
NzgonNzgon

In your Schedule APEX use Scope 1 for execution (second parameter).

By defoult it execue 200 at once and summary collection is going over governor limits.

 

Nash

All Answers

NzgonNzgon

In your Schedule APEX use Scope 1 for execution (second parameter).

By defoult it execue 200 at once and summary collection is going over governor limits.

 

Nash

This was selected as the best answer
ClaiborneClaiborne

That was it.

 

I was using the Scope variable in my manual process, but I forgot to include it in the schedulable class.

 

None of the examples of the Schedulable class showed the second field.