Development questions
Write a SOQL query to fetch all Contacts whose Birthdate is in the Current Calendar Month (WHERE CALENDAR_MONTH(Birthdate) = 10).
Use the CALENDAR_MONTH() date function in the WHERE clause. In Apex, bind the current month instead of hardcoding it.
soql
SELECT Id, Name, Birthdate FROM Contact WHERE CALENDAR_MONTH(Birthdate) = 10
apex
Integer m = Date.today().month();
List<Contact> cs = [SELECT Id, Name FROM Contact WHERE CALENDAR_MONTH(Birthdate) = :m];
soqlscenariodate-functions
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?