Development questions
How many levels deep can you traverse in a Child-to-Parent relationship query in SOQL? (Up to 5 levels, or 55 in newer API versions—explain both).
Child-to-parent traversal can go up to 5 levels deep using dot notation in a single path, e.g. Contact.Account.Parent.Owner.Manager.Name.
Separately, a query can reference many parent relationships overall: the documented limit for the total number of child-to-parent relationships in one query is 55 (a count of relationships, not depth). Mixing these up is a common interview mistake.
The exact numbers have changed across API versions, so confirm against the current SOQL limits documentation for your API version.
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?