Home/Resources/Architecture
Architecture7 min read

When to write Apex — and when to walk away.

A decision framework for Salesforce teams choosing between configuration, Flow, Apex, LWC and external services.

Key takeaways
  • Use configuration for simple, transparent business rules.
  • Use Apex when complexity, transaction control or testability demands it.
  • Walk away when Salesforce is the wrong execution environment.

The wrong question is “can Salesforce do it?”

The better question is whether Salesforce should own the logic. A rule that is customer-facing, auditable and close to CRM data may belong in Salesforce. A high-volume compute task, data transformation or long-running integration may belong elsewhere.

When configuration wins

Configuration is best when the logic is straightforward, business-owned and easy to inspect. Validation, guided screens, basic routing and standard approvals should not become code just because a developer is available.

When Apex is the safer choice

Apex is appropriate when rules need transaction boundaries, bulk handling, reliable tests, reusable domain services or controlled error handling. Complex revenue, orchestration and integration code is often safer as Apex than as a maze of flows.

When to walk away

Some requirements are signals to use an external service: heavy document processing, large batch transformations, complex search, event streaming or logic shared across multiple systems. Good architecture includes saying no to the platform when the platform is not the right tool.

Need this in your org?

Bring the hard part to a senior Salesforce engineering team.

Talk to the builders about this pattern