You need to sign in to do that
Don't have an account?
gbu.varun
Apex Developer Guide: Trigger and Bulk Request Best Practices
Trigger has limitation of the 100 SOQL records. It will exceed the SOQL query limit if more than 100 SOQL quries are made.
In the second example of the documentation following line is mentioned:
If more than 20 records are pulled into this request, the trigger would exceed the SOQL query limit of 100 SELECT statements:
But it will count only 20 soql queries so it should not exceed the limitation.
In the second example of the documentation following line is mentioned:
If more than 20 records are pulled into this request, the trigger would exceed the SOQL query limit of 100 SELECT statements:
trigger MileageTrigger on Mileage__c (before insert, before update) { for(mileage__c m : Trigger.new){ User c = [SELECT Id FROM user WHERE mileageid__c = m.Id]; } }
But it will count only 20 soql queries so it should not exceed the limitation.
yes, correct, But always we need to use SOQl's outside for loop.
Ex: if you insert more than 100 records through data loader or batch apex it will through error.
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support: varaprasad4sfdc@gmail.com
Salesforce latest interview questions and training videos :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
Thanks,
V Varaprasad
Email: varaprasad4sfdc@gmail.com