Apex Articles - Page 10
How to Get Current User IP Address and Location Using Apex
Capture the current user's IP address and location in Apex using Auth.SessionManagement, LoginHistory and...
Generic null-check and dynamic field mapping in Apex
Reusable Apex utility to copy non-null fields from a child SObject to parent using SObject.put. Reduce...
Update Only the Latest Child Record for Each Parent (Apex & SOQL Tips)
Use SOQL aggregate queries to pick a single latest child record per parent instead of querying all children — more...
Get Start and End Dates of the Previous Quarter in Apex
A compact Apex utility to calculate the start and end Date of the previous quarter based on Date.today(). Includes...
How to Calculate the Day of the Week from a Date and Actual Time Spent Between Two Date-Times in Apex
Quick guide: get weekday names from Date and compute actual business-hours time between two Datetime values in...
Getting Started with Apex Triggers in Salesforce
Learn the fundamentals of Apex triggers, including trigger context variables, best practices, and common patterns...
Efficient Ways to Call Apex Methods from LWC in Salesforce: Pros and Cons
Recalculate Formula Fields without DML Statement
Trigger assignment rules from apex
Automatically assign the leads or cases to users or queue using assignment rules when they are inserted via API or...