Development questions
How do you query Custom Metadata Types (getAll(), getInstance()) without consuming SOQL governor limits?
Custom metadata type records can be read with Apex methods that do not count against SOQL limits:
apex
Map<String, My_Setting__mdt> all = My_Setting__mdt.getAll(); // all records, keyed by DeveloperName
My_Setting__mdt one = My_Setting__mdt.getInstance('Default'); // by DeveloperName or Id
getAll()/getInstance() return cached records but not all long-text fields. Querying with SOQL still works (and counts toward limits) when you need filters or those fields.
soqlcustom-metadatagovernor-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?