Development questions
How many levels deep can you traverse in a Parent-to-Child subquery? (Standard 1 level vs up to 5 levels in API v58.0+ via REST/Apex limits).
Traditionally a parent-to-child subquery supports only one level (parent with its children, no grandchildren) in Apex. In API v58.0 and later, REST/SOAP query() calls can nest up to 5 levels of parent-to-child subqueries (e.g. Account → Contacts → Cases...). Apex inline SOQL remained limited, so check the current docs.
Also, a query can include at most 20 parent-to-child subqueries.
soql
SELECT Name, (SELECT LastName, (SELECT Subject FROM Cases) FROM Contacts) FROM Account
(nested form valid via API v58+ query).
soqlrelationshipslimits
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?