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
raSFUserraSFUser 

Question about scope Database.executeBatch()

I have a question about using batch and the passing in a Scope, lets say im processing a batch of 53 records, however due to other governance limits i need to use scope to limit 30 records per transaction.


e.g. 

Integer scopeSize = 30;
jobId = Database.executeBatch(batch, scopeSize);

If I use the something like the above, will one or two entries be created in the flex Queue ?
 
Select Count(Id) FROM AsyncApexJob Where Status = 'Holding'

Everything I have read doesn’t seem to detail this bit….
 
ShirishaShirisha (Salesforce Developers) 
Hi,

Greetings!

Yes,if you use the scopeSize as 30 and you are trying to process the 50 records then the records will be processed in 2 batches as the ScopeSize will be the number of the records per batch.

However,you can only see one job on the UI with the number of records processed.

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri