Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Administrator
hard

As an admin, when do you say "this needs Apex" vs solving declaratively?

Modern Salesforce admins increasingly own decisions that used to be developer-only. The boundary between "build in Flow" and "needs Apex" has shifted significantly toward declarative; Flow now handles most patterns. But some scenarios still genuinely need code.

Stay declarative when:

  • Logic fits in a single object's lifecycle and can be expressed as conditions + actions.
  • Performance demands are typical (single-record save, low frequency).
  • You can express the rule in a flow Decision element or a validation rule formula.
  • The integration target supports HTTP callouts (Flow can do those now).
  • You can update related records via Get Records + Update Records.

Reach for Apex when:

  1. Bulkified logic on millions of records — flows hit governor limits faster than Apex on heavy operations. A scheduled batch over 10M+ rows almost certainly needs Apex Batch.
  2. Recursive or self-referential logic — flows can't easily call themselves; Apex handles recursion patterns better.
  3. Custom sharing logic (Apex Managed Sharing) — there's no declarative way to write to __Share tables.
  4. Complex error handling and transaction controltry/catch, Database.SaveResult, partial-success patterns are easier in Apex.
  5. Performance-critical paths — every microsecond counts (e.g., real-time pricing engines, scoring algorithms running on every save).
  6. Wrapping a complex external service — multiple HTTP calls with conditional branching, JSON parsing, response composition. Flow can do callouts but the orchestration gets unwieldy.
  7. Custom UI logic — Lightning Web Components are JavaScript + Apex; declarative tools can't build truly custom interactivity.
  8. Custom REST/SOAP web services — exposing Salesforce as an API endpoint requires @RestResource or web service Apex.

Hybrid approach (often best):

  • Use Flow for orchestration (events, branches, user-facing actions).
  • Call Apex Invocable Methods from Flow for heavy lifting.
  • Stay declarative at the top level, drop into code only where needed.

Admin habit: keep a running list of "things I'd love to do but can't without code", revisit yearly. Each Salesforce release adds Flow capabilities; problems that needed Apex two years ago may now be declarative.

Senior admins know which patterns are truly Apex-only and don't waste cycles trying to fight Flow into doing them. They also know when to pull in a developer pair early rather than discover at week 3 that the solution doesn't scale.

Why this answer works

Senior admin / staff admin level question. Tests judgement about your own boundaries. Naming the hybrid Flow + Invocable Apex pattern signals modern thinking. The "yearly revisit" habit is what separates someone who's learning from someone who's growing.

Follow-ups to expect

Related dictionary terms