You need to sign in to do that
Don't have an account?
Raj R.
How do SOQL queries function when you limit by 500?
I have a schedulable class that copys the standard Account data into a custom Account object. My schedulable class code is as follows:
className implement Schedulable {
Lets say I have 100,000 Account I need to be copied into an Account object. Here is the preferred scenario:
• 1st run: copy accounts[1-500]
• 2nd run: copy accounts[501-1000]
• 3rd run: copy accounts [1001-1500]
• .........
• .......
• Last run: copy accounts [995,001-100,000]
How can I be sure that the scenario above will occur? Does the SOQL query return random 500 accounts or does it know that it needs to pick 500 different Accounts that have not been selected before?
className implement Schedulable {
List<Account> currentAcnts = [Select field1, field2,...FROM Account Limit 500];
/*
Code to copy data goes here
*/
}//end class/*
Code to copy data goes here
*/
Lets say I have 100,000 Account I need to be copied into an Account object. Here is the preferred scenario:
• 1st run: copy accounts[1-500]
• 2nd run: copy accounts[501-1000]
• 3rd run: copy accounts [1001-1500]
• .........
• .......
• Last run: copy accounts [995,001-100,000]
How can I be sure that the scenario above will occur? Does the SOQL query return random 500 accounts or does it know that it needs to pick 500 different Accounts that have not been selected before?
Your batch class is not complete for me to judge. However, if you have written a query which say by default process 200 records(you can override it to return 500 records in a batch) in a batch and use this query in start() method of batch class, then sure you can achieve above said scenario without any extra effort.
Please share your code snippet if possible, then I will be able to give more input.
Let me know if you have any specific question.
Regards,
Digamber Prasad
All Answers
Your batch class is not complete for me to judge. However, if you have written a query which say by default process 200 records(you can override it to return 500 records in a batch) in a batch and use this query in start() method of batch class, then sure you can achieve above said scenario without any extra effort.
Please share your code snippet if possible, then I will be able to give more input.
Let me know if you have any specific question.
Regards,
Digamber Prasad
global class ClassName implements Schedulable {
ApexClassName.insertMethod(act);
Hope this helps