Development questions
How do Governor Limits impact Apex Triggers (specifically the 100 SOQL and 150 DML limits)?
Governor limits apply per transaction, and all triggers, flows and classes firing in that transaction share them. Key synchronous limits: 100 SOQL queries, 150 DML statements, 50,000 query rows, 10,000 DML rows, 10 s CPU, 6 MB heap.
SOQL/DML inside a loop in a trigger exhausts 100/150 quickly when 200 records are processed, causing an uncatchable LimitException. Bulkify, use Maps and Sets, and keep other automations on the object in mind, since they consume the same budget. Check usage with the Limits class.
apex-triggertriggergovernor-limits
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?