+ Start a Discussion
ajay ambatiajay ambati 

interview based question

1,how many soql queries allowed in trigger not in apex class?
2,can we process one record in batch apex class?
Best Answer chosen by ajay ambati
Amit Chaudhary 8Amit Chaudhary 8
Hi ajay ambati,

Please check below post
1) https://developer.salesforce.com/page/Apex_Code_Best_Practices
2) https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
Limit is 100 SOQL only

You can set the Batch size one like below
AccountUpdateBatchJob obj = new AccountUpdateBatchJob();
            DataBase.executeBatch(obj,1);  // you can set size here
NOTE:- you are right by default size will 200
http://amitsalesforce.blogspot.in/2016/02/batch-apex-in-salesforce-test-class-for.html

Let us know if this will help you

 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
1,how many soql queries allowed in trigger not in apex class?
Amit:- 100
2,can we process one record in batch apex class?
Amit:- Yes

Let us know if this will help you
 
Srinivas SSrinivas S
Hi Ajay,

Max. number of SOQL queries per transaction: 100. (not for apex class or apex trigger)
Note: Transaction is the starting of the program execution to the ending of the program execution. Transaction:example: trigger is fired it will execute the logic and in that logic it is calling a method in someother apex class that will be executed intern it might be calling someother method, somewhere execution stops. 

------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
ajay ambatiajay ambati
1,you people saying 100 but i searched for this answers it saying that 20 in trigger

2, you saying in  batch class one record is allowed to process the execution but default is 200 to 2000 know how can we do this? we will go for the batch when we face governer limits or  to process(update) more than 50000 records
 
Amit Chaudhary 8Amit Chaudhary 8
Hi ajay ambati,

Please check below post
1) https://developer.salesforce.com/page/Apex_Code_Best_Practices
2) https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
Limit is 100 SOQL only

You can set the Batch size one like below
AccountUpdateBatchJob obj = new AccountUpdateBatchJob();
            DataBase.executeBatch(obj,1);  // you can set size here
NOTE:- you are right by default size will 200
http://amitsalesforce.blogspot.in/2016/02/batch-apex-in-salesforce-test-class-for.html

Let us know if this will help you

 
This was selected as the best answer