Skip to content

Salesforce Developer interview questions

100 real questions with model answers and explanations for Platform Developer candidates.

See a Salesforce Developer resume example

Practice with flashcards

Spaced repetition · Hunter Pass

Questions

triggers

I use one thin trigger that dispatches contexts to ordered handlers.

  • The trigger passes collections and contains no SOQL, DML, or business rules.
  • Handlers declare supported contexts, so insert logic cannot run on delete.
  • One registry makes validation, enrichment, and asynchronous work order explicit.

Why interviewers ask this: The interviewer checks whether the framework creates predictable behavior without excess abstraction.

designtriggersautomation

I map each write and side effect across the complete order of execution.

  • Before-save Flow handles simple same-record changes, while Apex owns complex collection logic.
  • After-trigger records have IDs, but their values are not final while later after-save Flow or automation can still update them.
  • Work that requires committed final state runs after commit and reloads the record, while repeated save cycles remain idempotent.

Why interviewers ask this: The interviewer checks practical reasoning about automation sharing one transaction.

transactionsrecursion

I guard a specific operation and record, not the whole transaction with one Boolean.

  • A Set of processed IDs or operation keys blocks only the repeated side effect.
  • Comparing old and new values avoids work when the relevant state did not change.
  • The design still allows a later trigger chunk or a different operation to run.

Why interviewers ask this: The interviewer looks for a safer approach than a transaction-wide static flag.

queriestriggers

It treats Trigger.new as one unit of work and controls queries, DML, CPU, and heap.

  • Sets collect relationship keys before one query with an IN filter.
  • Maps replace nested scans, and each logical write uses one DML call on a collection.
  • Queries select only needed fields and algorithms remain close to linear in record count.

Why interviewers ask this: The interviewer checks data shape and algorithmic cost, not only query placement.

triggers

The comparison turns a save event into a meaningful state transition.

  • A notification runs when Status changes to Approved, not on every unrelated edit.
  • The predicate is shared by single-record and bulk paths.
  • Fewer unnecessary queries, writes, and events also reduce recursion risk.

Why interviewers ask this: The interviewer checks whether automation responds to intent rather than every save.

apex

A Domain class owns invariants and behavior for one object type.

  • Trigger context methods operate on the current record set.
  • Validation and same-object state changes fit this boundary.
  • Cross-object use-case orchestration stays in a Service class.

Why interviewers ask this: The interviewer evaluates whether the candidate draws a useful object boundary.

A Service owns a complete use case that can coordinate several objects and boundaries.

  • Triggers, LWC controllers, and REST resources can call the same operation.
  • The public method expresses transaction intent rather than UI details.
  • Object invariants remain in Domain classes and queries remain in Selectors.

Why interviewers ask this: The interviewer checks that Service is a reusable use-case boundary, not a utility drawer.

queries

A Selector centralizes focused query shapes behind business-named methods.

  • Callers reuse field sets and relationship traversal consistently.
  • Tests can replace the selector through an interface.
  • I avoid one universal selector method that always over-fetches fields.

Why interviewers ask this: The interviewer checks both reuse and awareness of abstraction costs.

transactions

I register writes and relationships, then commit explicitly at the service boundary.

  • It groups DML and resolves parent-child references after parent IDs exist.
  • All writes follow one visible ordering policy.
  • I do not mix registered work with direct DML in the same use case.

Why interviewers ask this: The interviewer wants controlled DML coordination rather than pattern usage for its own sake.

injectiondependenciestesting

I inject interfaces for selectors and gateways instead of constructing implementations inside methods.

  • A test stub returns exact records without SOQL.
  • A fake gateway models success, timeout, or malformed responses without a callout.
  • Production wiring stays in a factory, outside business logic.

Why interviewers ask this: The interviewer checks whether business logic can be isolated from platform boundaries.

transactionsapex

The save, synchronous automation, and their DML normally share one transaction.

  • An unhandled exception rolls back earlier database changes in that transaction.
  • A queued asynchronous job starts later with fresh limits and its own commit.
  • That later job cannot make its external effect atomic with the original save.

Why interviewers ask this: The interviewer checks accurate reasoning about rollback and asynchronous boundaries.

I use a savepoint to roll back a known group of synchronous DML after a recoverable failure.

  • Rollback restores database state after the savepoint.
  • It does not reverse an HTTP side effect already accepted externally.
  • I keep the protected region small and still return a clear error outcome.

Why interviewers ask this: The interviewer checks that savepoints are not mistaken for distributed transactions.

databasedata-model

Database methods with allOrNone false return one result per input record.

  • Each SaveResult must be matched to its source record.
  • Errors include messages and fields that should be persisted or returned.
  • Downstream work uses only successful IDs because failed rows were not written.

Why interviewers ask this: The interviewer checks explicit handling of partial outcomes, not just use of a flag.

data-modelconcurrency

I follow the business invariant, not implementation convenience.

  • A quote and dependent lines fail together to avoid an incomplete document.
  • Independent contacts can succeed separately.
  • Partial failures retain source row keys and support safe retry.

Why interviewers ask this: The interviewer checks whether transaction semantics match the business case.

queries

A selective filter lets the optimizer narrow rows through an index instead of scanning most data.

  • IDs, relationship keys, external IDs, and suitable indexed fields are good candidates.
  • Broad negative predicates and low-cardinality values often remain expensive.
  • I confirm the combined predicate with Query Plan on representative data.

Why interviewers ask this: The interviewer checks optimizer reasoning without memorized thresholds.

queries

I compare leading operation, estimated cardinality, and relative cost.

  • A narrow index plan is usually better than a table scan.
  • An index with low-cardinality values can still produce a poor plan.
  • After changing filters, I run Query Plan again on representative data.

Why interviewers ask this: The interviewer checks whether Query Plan provides evidence for a targeted change.

queries

I traverse to the parent when each child needs a small parent field set in the same result.

  • It removes a second query and a manual map join.
  • Only required parent fields are selected.
  • Separate queries are clearer when filters or the relationship graph diverge.

Why interviewers ask this: The interviewer checks a concrete query-shape decision rather than syntax recall.

subqueries

I use it when a parent and a bounded child collection are consumed together.

  • The child subquery can filter and order only relevant open records.
  • It keeps the service result aligned with the UI shape.
  • Unpredictable child volume is queried separately and grouped by parent ID.

Why interviewers ask this: The interviewer checks whether child cardinality influences the design.

joinsqueries

They filter parents by the existence or absence of children without loading those children.

  • A semi-join finds accounts with open opportunities.
  • An anti-join finds accounts with no active contacts.
  • Child details are queried separately only when the use case needs them.

Why interviewers ask this: The interviewer checks relationship-aware filtering that reduces transferred data.

queriesinjection

I allowlist identifiers and bind all data values where supported.

  • Field names and sort directions come only from known mappings.
  • User text is bound rather than concatenated, even if escaping is available.
  • Unknown object or field API names are rejected before query construction.

Why interviewers ask this: The interviewer checks whether values are distinguished from identifiers.

Locked questions

  • 21

    What is data skew, and how does it affect local design?

    design
  • 22

    How do Future and Queueable Apex differ in a design decision?

    designasync-apexdata-structures
  • 23

    When is Batch Apex better than Queueable Apex?

    batchasync-apexdata-structures
  • 24

    What role should Schedulable Apex play?

    apex
  • 25

    How do QueryLocator and scope size affect Batch Apex?

    batchasync-apexqueries
  • 26

    When is Database.Stateful justified?

    database
  • 27

    What transaction boundaries matter in a Queueable chain?

    transactionsdata-structuresasync-apex
  • 28

    How do you combine callouts and DML in asynchronous Apex?

    asyncapexdata-model
  • 29

    What does Platform Event publish behavior mean for transaction design?

    designeventstransactions
  • 30

    How should a Platform Event subscriber use replay information?

    events
  • 31

    When do you choose CDC instead of a custom Platform Event?

    events
  • 32

    How do you decide whether automation belongs in Flow or Apex?

    automationapex
  • 33

    How do you keep Flow and Apex from duplicating side effects?

    automationapex
  • 34

    What is the practical difference between with, without, and inherited sharing?

    ownership
  • 35

    Why is sharing enforcement insufficient for an Apex endpoint?

    endpointsapex
  • 36

    When do you use WITH USER_MODE or AccessLevel.USER_MODE?

  • 37

    When is Security.stripInaccessible the right tool?

  • 38

    What does cacheable=true mean for a wired Apex method?

    cachingapex
  • 39

    How do you choose between Lightning Data Service and custom Apex?

    lightningapex
  • 40

    How should refreshApex be used after an imperative mutation?

  • 41

    How do nested LWCs communicate cleanly?

    communication
  • 42

    When is Lightning Message Service preferable to DOM events?

    domlightning
  • 43

    How do LWC lifecycle hooks affect rendering performance?

    hookslightningperformance
  • 44

    What should a useful Jest test for an LWC verify?

    lightningjest
  • 45

    How do Named Credentials and External Credentials divide responsibilities?

    credentials
  • 46

    How do you choose among REST, SOAP, Composite, and Bulk API 2.0?

    restbulk-api
  • 47

    How do OAuth, transaction rules, retries, and idempotency shape a callout?

    oauthidempotencytransactions
  • 48

    When are Custom Metadata Types the right configuration store?

    metadataconfig
  • 49

    How do test factories, mocks, runAs, and asynchronous tests fit together?

    mockingasync
  • 50

    How do Salesforce DX, scratch orgs, unlocked packages, and deployment validation fit a workflow?

    deploymentscratch-orgsvalidation
  • 51

    An Opportunity update runs the same after-update action twice after a Flow change. How do you diagnose it?

    automation
  • 52

    A static Boolean guard works for 200 records but skips a second trigger chunk in the same transaction. What do you change?

    transactionstriggers
  • 53

    Database.update with partial success reports 7 failures among 120 rows. How should the service respond?

    database
  • 54

    Code sets a savepoint, inserts audit rows, then attempts an HTTP callout and fails. How do you redesign it?

    http
  • 55

    A list view query becomes nonselective after Case volume grows to 600,000 records. What do you inspect first?

    queries
  • 56

    Query Plan still chooses a table scan after you add an indexed checkbox filter. Why?

    indexesqueries
  • 57

    Two jobs updating contacts under the same accounts intermittently get UNABLE_TO_LOCK_ROW. What do you change?

  • 58

    One integration user owns 300,000 actively updated records and saves slow down. What is your hypothesis?

    hypothesis-testing
  • 59

    The third Queueable in a five-step chain never runs, but the first two committed. How do you recover?

    async-apexdata-structures
  • 60

    A Queueable callout fails after all normal retries. What can a Transaction Finalizer add?

    transactionsdata-structuresasync-apex
  • 61

    A Batch with scope 200 times out because each record needs expensive pricing logic. What do you tune?

    pricingbatch
  • 62

    A Database.Stateful batch reports inconsistent totals after a retry. How do you make reporting reliable?

    resiliencebatchdatabase
  • 63

    Nightly jobs delay user-triggered Queueables for hours. How do you address shared async capacity?

    capacitytriggersasync-apex
  • 64

    A Platform Event consumer creates duplicate orders during reconnects. What is the fix?

    events
  • 65

    A subscriber was offline beyond the Platform Event replay window. How do you close the gap?

    events
  • 66

    One Platform Event subscriber fails on malformed payloads and its backlog grows. How do you isolate the failure?

    backlogevents
  • 67

    A CDC consumer writes an enrichment back to the same record and creates a feedback loop. How do you stop it?

    feedback
  • 68

    A before-save Flow and a before trigger set Discount__c to different values. How do you resolve the conflict?

    triggersautomation
  • 69

    Apex-created shares on Project__c disappear after ownership changes. How do you make them durable?

    ownershipapex
  • 70

    An External Services action disappears from Flow after an OpenAPI schema update. How do you recover safely?

    schemaopenapiautomation
  • 71

    User-mode DML starts failing after a permission-set change. How should the service handle it?

    data-model
  • 72

    An LWC using lightning-record-edit-form stays in a saving state after a server-side validation rule rejects the save. What do you change?

    formslightningvalidation
  • 73

    An LWC enters a rerender loop after renderedCallback updates a reactive property. How do you fix it?

    reactlightning
  • 74

    A Salesforce CPQ price rule works in Product Configurator but not after quantity changes in Quote Line Editor. What do you inspect?

    cpqconfigsalesforce
  • 75

    A workspace LWC receives each LMS message twice after users reopen its tab. What is the likely leak?

    lightning
  • 76

    refreshApex resolves but the UI does not change. What common mistake do you look for?

    ownership
  • 77

    A Jest test asserts before an imperative Apex promise updates the DOM. How do you stabilize it?

    promisesapexjest
  • 78

    A wired Jest test passes alone but fails after another test. What isolation issue do you inspect?

    jest
  • 79

    An external REST API returns 429 during a burst of 80 updates. How do you retry safely?

    restresilience
  • 80

    A POST times out after the remote service may have created the resource. What do you do next?

  • 81

    A Named Credential callout starts returning 401 after credential changes. How do you diagnose it?

    credentials
  • 82

    A Visualforce page approaches the 170 KB view-state limit and becomes slow on postback. How do you diagnose and reduce it?

    visualforce
  • 83

    A Composite API request returns HTTP success but two subrequests failed. How do you handle it?

    httpcomposite-apisoft-skills
  • 84

    A Bulk API 2.0 ingest job completes with failed rows. What is your recovery flow?

    bulk-apiautomation
  • 85

    A feature works in one sandbox but routing is empty after deployment. Custom Metadata is involved. What do you check?

    deploymentmetadata
  • 86

    A service branches on a Custom Permission, but its tests cover only the allowed path. How do you test both paths?

    testing
  • 87

    A shared test factory now creates duplicate external IDs in parallel tests. What do you change?

    testing
  • 88

    A System.runAs test claims FLS is enforced, but production exposes a field. What went wrong?

    system-design
  • 89

    A Platform Event test publishes successfully, but subscriber assertions see no changes. What is missing?

    events
  • 90

    An unlocked package version fails because a referenced metadata component is outside its dependency graph. What do you do?

    componentsdependenciesmetadata
  • 91

    A component from an unlocked package is hotfixed by source deployment, then the next package upgrade removes the fix. How do you prevent that drift?

    deploymentiaccomponents
  • 92

    A trigger hits CPU time after a bulk import even though it has no SOQL in loops. What do you inspect?

    queriestriggers
  • 93

    A record-triggered Flow invokes Apex during a bulk import, but the invocable action handles only the first request. How do you redesign it?

    triggersautomationflow
  • 94

    A Platform Event subscriber queries the new record but cannot find it intermittently. What publication setting do you inspect?

    queriesevents
  • 95

    A CDC integration processes many irrelevant updates and falls behind. How do you reduce the work?

    concurrency
  • 96

    Two rapid filter changes in an LWC show results for the older request. How do you fix the race?

    lightning
  • 97

    A SOAP integration returns a business fault inside an HTTP response. How do you classify it?

    http
  • 98

    OAuth succeeds, but the remote API returns 403 for one endpoint. What do you check?

    oauthendpointsapi
  • 99

    A scratch org shows source conflicts after a teammate changed the same Flow. How do you resolve them safely?

    automationscratch-orgs
  • 100

    A deployment removes an Apex class that is still referenced by a Flow. How do you plan the removal?

    automationdeploymentapex