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
Scott0987Scott0987 

batch apex for integer

I am pretty new to batch apex.  I have written it a couple of times for database querys, but have a different need for it and am not sure where to go with it.  What I have is an integer say 150,000.  I would like to ran batch apex on it in groups of 10,000.  how would I go about doing that?

SidharthSidharth

 By integer 150,000, you mean you have 150,000 records? And you have to process 10,000 records per batch ?

Scott0987Scott0987

No I don't have records at all.  I have the number 150000 and I want to run the same piece of code in groups of 10000 until I have reached that number.  

Scott0987Scott0987

I guess I should clarify it better.  I am making a call out to an external system. I will be getting a list of emails from the other system.  I have a field that lists the total number of emails in the other system.  but there is a limitation to the number I can get at a time.  I can only pull 10000 emails at a time.  So what I want to do is take the field (which is around 150000 right now) and then use batch apex to get all of those emails in groups of 10000 since that is my limitation in the other system. 

SidharthSidharth

what type of query you using to get data/email list from the external system? Can you put limit of 10k there?