Salesforce Apex & Triggers Handbook for Developers

I put together this complete Apex handbook as a single, go-to reference for every developer working within the Salesforce platform — whether you’re just setting up your first dev environment or designing enterprise-grade trigger frameworks. This page organizes all the Apex tutorials I’ve written into focused sections so you can navigate directly to what you need.

Apex is Salesforce’s strongly typed, object-oriented programming language built natively into the platform. It lets me — and you — execute custom business logic in response to system events, write complex data operations, build automation, and create rich user interfaces using Visualforce. Think of it as the engine behind every advanced Salesforce customization.

My goal with this Apex & Triggers Handbook is simple:

  • If you are new to Apex, you can follow a clean learning path from basics to advanced topics.
  • If you already write Apex, you can use this page as a reference for trigger patterns, async Apex, callouts, LWC integration, and error handling.

You can bookmark this page and treat it as your main Apex guide while working on Salesforce implementations.

Who this Salesforce Apex & Triggers guide is for

This guide is for you if:

  • You are an Admin or Consultant moving from “clicks” (Flows) into “code” (Apex).
  • You are a Developer who wants clear, practical Apex examples instead of only theory.
  • You are an Architect who wants to standardize Apex patterns across multiple projects.

I will start with Apex fundamentals, then dive into triggers, async Apex, callouts, LWC integration, and finally error handling and best practices.

Setting Up Your Development Environment

Before writing a single line of Apex, you need a properly configured development environment. These tutorials walk you through connecting VS Code to your Salesforce org and resolving common setup issues that trip up most new developers.

Variables, Data Types & Type Conversions

Understanding data types and how to convert between them is foundational to writing reliable Apex code. I cover every major conversion scenario here — from strings to integers, dates, booleans, blobs, and more — so you always know exactly how to handle data in any context.

String Operations & the String Class

The String class in Apex is one of the most used tools in any developer’s toolkit. I’ve documented every important method — from case conversion and splitting to null checks, character detection, and SOQL-based string queries — so you can handle any string manipulation scenario with confidence.

Collections: List, Set & Map

Collections are at the heart of bulkified Apex code. In this section, I walk through how to create and work with Lists, Sets, and Maps — including how to convert between them — so you can write efficient, governor-limit-friendly logic that handles bulk data operations cleanly.

Control Flow, Loops & Operators

Writing clean, readable logic in Apex requires a solid understanding of control flow statements. Here, I cover every loop type, conditional structure, and operator — including some of the more powerful modern Apex features like the safe navigation operator and null coalescing operator.

Object-Oriented Programming in Apex

Apex is a fully object-oriented language, and understanding its OOP principles unlocks cleaner, more maintainable architectures. I cover everything here — from classes and constructors, to inheritance, interfaces, polymorphism, abstraction, and advanced patterns like dependency injection.

SOQL: Salesforce Object Query Language

SOQL is how I retrieve data from Salesforce, and it has far more depth than most tutorials cover. This section is the most comprehensive reference I’ve built — covering every clause, operator, pattern, limit, and security consideration you’ll need in real-world development.

SOQL Fundamentals

SOQL Clauses & Operators

Advanced SOQL Techniques

Querying Specific Objects & Scenarios

Security & Permissions in SOQL

SOSL: Salesforce Object Search Language

SOSL is Salesforce’s full-text search language, and it operates very differently from SOQL. I cover both static and dynamic SOSL patterns here, along with a clear comparison so you know exactly when to use each one.

DML: Data Manipulation Language

DML operations are how Apex writes data back to Salesforce. These tutorials go beyond simple insert/update/delete — I cover callout ordering, the addError() method, duplicate rule bypass, and record merging so you can handle every data operation scenario correctly.

Apex Triggers

Apex Triggers are the backbone of event-driven customization on Salesforce. This section covers everything — from trigger fundamentals and context variables, to the Trigger Handler Pattern, helper classes, recursion prevention, and real-world automation scenarios. I’ve structured these tutorials in the order I recommend learning them.

Trigger Fundamentals

Trigger Design Patterns

Trigger Use Cases & Examples

Asynchronous Apex

Asynchronous Apex lets me run long-running jobs, schedule recurring processes, and chain complex logic outside of synchronous execution limits. These tutorials cover all three major async patterns — Batch, Scheduler, and Queueable — with practical, real-world examples.

Visualforce Pages with Apex

Visualforce remains a widely used UI framework in existing Salesforce orgs. This section walks through building forms, controllers, PDFs, pagination, and file uploads — as well as how to bridge Visualforce with modern Lightning Web Components.

User Management with Apex

Managing users programmatically is a common enterprise requirement. I cover the full range of user operations here — creating users, activating or deactivating accounts, resetting passwords, managing group memberships, and reading current user context at runtime.

Apex Integration with Other Salesforce Features

Apex doesn’t work in isolation — it connects with Flows, Lightning Web Components, custom labels, email utilities, and REST callouts. These tutorials cover the integration touchpoints I use most frequently in production projects.

Troubleshooting & Debugging

Even experienced developers run into Apex errors that are hard to diagnose. I’ve documented the most common runtime errors, limit exceptions, and flow-trigger conflicts here — with clear explanations and proven fixes.

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.