Development questions
Write a SOQL query to fetch all active ValidationRule or CustomField metadata records using the Tooling API query structure.
Metadata objects such as ValidationRule and CustomField are queried through the Tooling API (/services/data/vXX.0/tooling/query/?q=...), not the standard query endpoint.
soql
SELECT Id, ValidationName, Active, EntityDefinition.QualifiedApiName FROM ValidationRule WHERE Active = true
SELECT Id, DeveloperName, TableEnumOrId FROM CustomField
Only ValidationRule has an Active flag; CustomField records are queried by name or object (there is no 'active' state for fields).
soqlscenariotooling-apimetadata
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?