Development questions
What does the ALL ROWS keyword do in SOQL, and how do you query records currently in the Recycle Bin (IsDeleted = true ALL ROWS)?
ALL ROWS includes deleted records (Recycle Bin) and archived activities in the results. Combine with IsDeleted = true to get only deleted records.
apex
List<Account> deleted = [SELECT Id, Name FROM Account WHERE IsDeleted = true ALL ROWS];
Used to find records to undelete (undelete deleted;) or for audit. Without ALL ROWS, deleted records are not returned.
soqlkeywordsrecycle-bin
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?