Complete Interview Prep Series
Salesforce Apex Triggers — Theory to Production
Apex Triggers are the single most-tested topic in Salesforce Developer interviews, at every level. This series takes you from core concepts through 30 write-the-code questions, test class strategy, and real production incident scenarios — the complete path, not a random list.
4Parts
80+Questions
30Code Examples
~4hEst. Read Time
FreeNo Signup
Overview
Interviewers test Apex Triggers two ways: theory ("what is a before trigger, and when does Trigger.old contain data?") and applied coding ("write a trigger for this exact business requirement, right now"). Most candidates study only the first and get exposed on the second. This series is built in that same order — theory first, then code, then testing the code you wrote, then the production judgment senior roles actually screen for.
Prerequisite: basic familiarity with Apex syntax (variables, SOQL, if/for statements). If you're completely new to Apex, start with Admin Fundamentals first, then return here.
The Curriculum
Four parts, designed to be read in order
1
Part 1 · Theory
Beginner
45 min
Complete Theory & Concepts
Every concept and definition interviewers ask about before you write a single line of code — trigger syntax, context variables, and governor limits.
You'll Learn
Trigger contexts (before/after)
Trigger.new / .old / .oldMap
Order of execution
Trigger vs Workflow vs Flow
Handler pattern basics
50+ questions
Start Part 1
2
Part 2 · Write the Code
Intermediate
90 min
30 Write-the-Code Questions
Real "write a trigger for this" prompts with complete working Apex, common mistakes explained, and XYZ Company business examples.
You'll Learn
Bulkification patterns
Validation & business rules
Handler pattern in practice
@future / Queueable in triggers
30 coding questions
Start Part 2
3
Part 3 · Test Classes
Intermediate
60 min
Test Classes for Triggers
Writing real test classes for the triggers from Part 2 — mocking, bulk testing, negative cases, and meaningful assertions, not just coverage percentage.
You'll Learn
@testSetup patterns
Test.startTest/stopTest
HttpCalloutMock
Bulk testing (200 records)
20+ questions
Start Part 3
4
Part 4 · Real Scenarios
Advanced
75 min
Real Scenario Deep Dives
Architecture decisions, production debugging, and large-scale trigger design — the judgment questions senior interviews actually screen for.
You'll Learn
Multi-trigger orchestration
Mixed DML & recursion
2AM incident response
Large Data Volume design
20 scenarios
Start Part 4
Assess Yourself
Reading is step one. Testing under time pressure is what actually prepares you.
100 Timed Apex Trigger MCQs
A separate, scored assessment covering everything across all four parts — the fastest way to find the specific gaps in your understanding before an interview. Candidates who take this before their interview consistently report walking in with more confidence, because they've already found and fixed their weak spots instead of discovering them live under pressure.
Topic Reference
Everything covered across all four parts, at a glance
Trigger BasicsSyntax, contexts, Trigger variables, before vs after, insert/update/delete/undelete
BulkificationSOQL-in-loop fix, Maps vs Sets, AggregateResult, bulk DML patterns — the #1 interview filter
Handler PatternOne trigger per object, handler class architecture, separation of concerns, testability
Recursion PreventionStatic Set<Id> guard, why recursion happens, and the pattern interviewers explicitly expect
Validation TriggersaddError(), field-level vs record-level errors, profile-based rules, stage transitions
Audit & LoggingField change detection using Trigger.oldMap, audit log creation, Database.SaveResult
Async Apex in Triggers@future(callout=true), Queueable chaining, when to use each, System.enqueueJob
Custom Metadata-Driven RulesConfigurable business rules without a code deployment, round-robin assignment, rollup config
Scenario QuestionsReal XYZ Company scenarios — Visit Reports, Order protection, Closed Won handling
Merge & ReparentingMasterRecordId, auto vs manual reparenting, custom object orphan prevention
Custom RollupsWhy standard rollup isn't always enough, AggregateResult rollup pattern, all 4 DML events
Error HandlingDatabase.insert(list, false), partial success, SaveResult[], Error_Log__c pattern
How to Prepare
Five habits that consistently separate strong candidates from weak ones
Start with Part 1 theory — understand concepts before writing code. Know what before/after means, what Trigger.old contains on delete, and the governor limits that shape every design decision.
Master bulkification first — the majority of Apex trigger interview rejections cite "not bulkified." No SOQL in loops. No DML in loops. Always Maps and Sets.
Practice the handler pattern until it's automatic — every senior interview asks about this directly. One trigger per object, logic in a separate handler class.
Narrate your thinking out loud — interviewers are evaluating your reasoning process, not just the final code. State which context you're using and why before you start typing.
Prepare two or three real examples in advance — "at my previous company, we had a trigger that..." lands far better live than it does improvised. Use the XYZ Company scenarios in Part 4 as templates.
Related Interview Prep
sfinterviewpro.com
1,500+ questions across 30 topics. 6 free courses. Always free. No paywall. No signup.