Domain-Driven Design: A Path to Enterprise Salesforce Success
Domain-Driven Design for Salesforce Architecture

Domain-Driven Design: A Path to Enterprise Salesforce Success

Introduction: Why We’re Here

I have more than seven hundred fields on Account—how did we get here?” This is a common scenario in enterprise Salesforce implementations. It started small: just a handful of custom fields to track leads and a few extra data points for sales. Yet over time, multiple departments—marketing, service, finance, operations, and more—piled on their requirements, turning Account into a tangled web of checkboxes, picklists, and automation rules. The same happened with Contact, Leads, Opportunities, and Cases.

Could Domain-Driven Design (DDD) offer practical value? You might think, “Isn’t that for microservices? Isn’t DDD for developers building from scratch?” But as we examined our Salesforce challenges—lack of clarity, inconsistent ownership, and endless cross-department conflicts—it became clear that DDD principles could bring much-needed structure and sanity to our org.

If you’re reading this, you might be facing a similar situation or looking to avoid it altogether. Let’s explore why DDD is so relevant to Salesforce, how it works in practice, and what you can do to start taming your own “happy soup” or “big ball of mud.”


Domain-Driven Design Meets the Salesforce Platform

Domain-driven design (DDD)?is a software development approach that aligns system design with core business domains. It emphasizes a?shared language,?clearly bounded contexts, and architectures that reflect real business processes rather than forcing them to conform to technology.

  • Shared language (Ubiquitous Language): A common vocabulary that both business and technical teams use to describe concepts, ensuring clarity and alignment.
  • Bounded contexts: Clearly defined boundaries within which specific business terms and rules apply. This prevents conflicts when different teams use the same terms but mean different things.

“But Isn’t Salesforce Already a Structured Platform?”

Yes and no. Salesforce provides out-of-the-box cloud solutions—Sales Cloud, Service Cloud, Experience Cloud—built on standard objects like Accounts, Contacts, Cases, and Opportunities. This makes it easy to get started. However, as your organization grows and more teams share the same org, these standard objects often become catch-alls, forcing every business requirement into a single data model. Before you know it, you’re dealing with hundreds of fields, multiple record types, convoluted processes, and frequent conflicts between departmental needs.

DDD provides a framework to step back and reassess: Who owns what data and processes? Where should those responsibilities live? How should different business domains interact? By answering these questions, DDD helps bring clarity and structure to an increasingly complex Salesforce environment.


Why DDD Matters for Salesforce

Complexity Emerges Over Time

We might start with a simple leads pipeline, but as marketing, customer support, finance, and legal get involved, a single org can quickly balloon in complexity. DDD principles help us recognize these different functional areas as distinct bounded contexts, preventing unnecessary entanglement.

Bounded Contexts Prevent a Monolithic Org

Logically separating our org—so that marketing has its own data model and service has another—reduces the risk of field collisions, conflicting triggers, and automation sprawl.

Master Data as the Shared Kernel

Core objects like Account, Contact, Account Contact Relationship, and Users sit at the intersection of multiple business domains, making governance essential. These are master data, and managing them effectively is never easy. A structured approach to Master Data Management (MDM) helps maintain consistency and prevents uncontrolled sprawl.

Strategic Integrations

Many enterprises integrate Salesforce with ERP systems, legacy mainframes, or microservices. DDD’s context mapping patterns—such as anti-corruption layers and customer-supplier relationships—help insulate Salesforce from external complexities, ensuring smoother interoperability.

Clear Ownership and Governance

DDD clarifies who is responsible for specific objects, fields, and processes, fostering accountability and reducing the dreaded “Oops! I changed a field your team depended on” moments.


Key DDD Principles in Salesforce Terms

1. Ubiquitous Language

In each domain context, use business terms for objects, fields, and automation. If our domain is “Sales,” stick to words like “Opportunity,” “Quota,” or “Forecast.” Don’t overload them with marketing concepts like “Campaign” or finance concepts like “Invoice.” This clarity fosters better communication between tech and non-tech folks.

?? Tip: For cross-domain data like Account and Contact, carefully govern shared fields to prevent bloat. Document their definitions to ensure all stakeholders understand their purpose.

2. Bounded Contexts

A bounded context defines where a particular domain model (and its rules) applies. This is how we avoid turning our entire Salesforce org into an unmaintainable monolith. We can implement bounded contexts with:

  • Unlocked Packages: Each domain has its own package with relevant objects, code, and automation.
  • Naming Conventions: E.g., “Sales_***t__c” vs. “Finance_***__c,” so it’s clear which domain each custom object belongs to.
  • Permission Sets & Apps: Users only see objects and tabs relevant to their domain.

3. Context Mapping

When two domains need to share data or processes, context mapping patterns define how they collaborate:

  • Shared Kernel: Minimal common objects (e.g., Account, Contact) that multiple domains rely on.
  • Customer-Supplier: One domain provides data/services to another (e.g., Marketing → Sales).
  • Anti-Corruption Layer (ACL): Typically a service layer or integration layer that translates data between domains or systems, ensuring we don’t pollute our domain model.
  • Conformist: A smaller domain might simply adopt the data model of a larger domain instead of reinventing the wheel. Numerous third-party apps on the Salesforce AppExchange depend on the standard Salesforce data model – and the standard use of the data model.?

4. Entities, Value Objects, and Aggregates

Even though Salesforce isn’t purely OOP, we can still model:

  • Entities: Records with identity (e.g., “Opportunity #12345”).
  • Value Objects: Reusable data structures without identity (e.g., a custom “Address” field set).
  • Aggregates: Clusters of records that logically update together (e.g., Opportunity plus its line items).

5. Domain Events

Salesforce Platform Events offers an event-driven architecture that helps domains communicate asynchronously. For instance, we can publish a “DealClosed” event in the Sales domain. The Finance domain, upon receiving this event, creates an invoice—no direct calls or dependencies are needed.

Example: When a “DealClosed” event is published in the Sales domain, the Finance domain listens for it and generates an invoice—without requiring direct dependencies between them.


The Architect’s Responsibilities

As Steven Herod (Managing Director at Accenture) emphasized in an interview:?

"Architecture is the stuff that’s hard to change in our application. And not having clear boundaries... is a leading cause of confusion."

As architects, our role is to define, enforce, and evolve boundaries within Salesforce to ensure scalability, maintainability, and clarity across domains. Our key responsibilities include:

Structuring the Org for Scale

  • Establish a modular architecture that allows Salesforce to scale with the business.?
  • Use bounded contexts to prevent standard objects from becoming overloaded catch-alls.
  • Ensure clear domain ownership so each business function controls its own data model.

Standardizing Domain Models

  • Document domain models to help teams understand and respect system boundaries.
  • Ensure consistent naming conventions for objects and fields, preventing cross-domain confusion.
  • Maintain a shared vocabulary within each domain to align technical and business teams.

Defining Domain Boundaries & Managing Data Flow

  • Implement context mapping to define how domains interact (Shared Kernel, Customer-Supplier, Anti-Corruption Layer).
  • Govern cross-domain data flow to prevent excessive dependencies and data duplication.
  • Clearly define which domains own which objects and how shared data (e.g., Accounts, Contacts) is managed.

Enforcing Integration & Communication Patterns

  • Use proper integration patterns (e.g., API gateways, event-driven architectures, anti-corruption layers) to keep domains loosely coupled.
  • Salesforce can effectively participate in a microservices architecture, either as a provider or consumer of services. The PwC Tech Blog notes that Salesforce's multitenant platform makes it straightforward to build and expose microservices via REST APIs with automatic scaling. This approach allows enterprises to offload specialized processing or functionality that would otherwise hit governor limits.
  • A particularly effective pattern is using Platform Events for event-driven microservices communication. For example, when a deal closes in Salesforce, a platform event can notify an external invoicing microservice to generate an invoice—without Salesforce needing to know the implementation details. This loose coupling allows both systems to evolve independently while maintaining integration through well-defined event contracts.

Governing Shared Data & Master Data Management (MDM)

  • Establish clear governance over shared objects like Account, Contact, and User to avoid bloat and conflicting definitions.
  • Align with MDM best practices to keep master data clean, consistent, and properly owned across domains.

Establishing Ownership & Governance

  • Define who is responsible for objects, fields, automation, and integrations within each domain.
  • Prevent ad-hoc modifications that disrupt other teams by enforcing strict change management policies.
  • Foster accountability to avoid accidental changes that impact multiple domains.

A well-architected Salesforce org ensures business agility, reducing complexity, and creating a system that remains maintainable as the organization evolves.

Incremental Adoption: From Startup to Enterprise

Startup Phase

  • We may have a straightforward Salesforce setup for one department.
  • DDD is probably overkill here—keep it simple!

Growth Phase

  • More departments start customizing the same org, leading to overlapping requirements.
  • Domain boundaries emerge naturally (e.g., Sales Cloud, Service Cloud).
  • Begin tracking ownership of shared data to avoid early technical debt.

Scale Phase

  • The need for intentional domain separation becomes clear to maintain development velocity.
  • Start refactoring into domain-specific packages to prevent a monolithic org.
  • Introduce Salesforce Platform Events for asynchronous communication.
  • Set up an integration layer to manage external system dependencies efficiently.

Enterprise Phase

  • Well-defined domains with dedicated teams responsible for their respective data and processes.
  • A robust event-driven architecture enables seamless cross-domain interactions.
  • Continuous domain alignment—as the business evolves, boundaries are revisited and adjusted to prevent drift.


Step-by-Step: Adopting DDD in an Existing Org

Assess & Prioritize

  • Identify the biggest pain points (e.g., an 800-field Account, performance bottlenecks, or integration nightmares).
  • Prioritize areas where DDD can provide the most immediate impact.
  • Identifying domains and finding their boundaries requires business domain expertise, not just technical knowledge. Overly broad domains remain messy; overly narrow ones spawn unnecessary complexity.

Start with a Quick Win

  • Choose a manageable starting point (e.g., isolating Service from the rest of the org).
  • Map out the current “spaghetti” design—who depends on what? Where do dependencies create friction?
  • Package objects, automation, and logic into a separate module.
  • Demonstrate quick wins, e.g., fewer fields on standard objects; improved performance; and simpler, domain-specific user experiences.

Refactor Incrementally

  • Move domain-specific fields from overloaded standard objects into custom domain objects.
  • Introduce Platform Events to decouple triggers, flows, and automation spanning multiple contexts.
  • Enforce clear boundaries using packaging or naming conventions (e.g., Sales_***__c, Finance_***__c) to separate domain logic.

Align Teams with Domains & Define Governance

  • Assign domain owners (people or teams) responsible for approving field additions and code changes within their context.
  • Structure teams around domains, not just technical roles, e.g., a Sales team manages the Sales package; a Finance team owns Finance objects and logic.
  • Foster cross-functional collaboration for shared kernel changes.
  • Establish a collaborative review board to manage cross-domain dependencies, shared data, and functionality.

Continuous Evolution

  • Revisit domain boundaries whenever business processes shift—DDD is an ongoing practice, not a one-time fix.
  • Document the domain model so new team members can quickly understand the org’s structure.


Conclusion: Is DDD Worth It?

If we have multiple business functional departments sharing one Salesforce org—and if we’re seeing runaway customization, confusing data structures, or integration headaches—Domain-Driven Design is a potent antidote. Even though Salesforce is not a custom-coded, ground-up platform, we can still apply core DDD concepts to:

  • Create bounded contexts that keep complexity in check.
  • Maintain a ubiquitous language for each domain, reducing confusion.
  • Use context mapping to coordinate cross-domain interactions without polluting each other’s data models.
  • Foster a sense of ownership and governance, making our org more resilient and adaptable.

The bottom line? As Steven Herod puts it:

"No one ever failed a project because method names are wrong... but it’s what would happen if we try and use a single contact record for seven or eight different uses."

Don’t let our Salesforce org turn into the dreaded “big ball of mud.” DDD shows us how to carve it up into manageable, logical domains that mirror the business itself. Whether you’re just beginning to sense the mess or are well into the 800-field zone, embracing a domain-driven perspective could be the difference between a sustainable, evolving platform and an unholy tangle of fields, triggers, and unhappy users.


Further Reading & References

Feel free to dive deeper into these articles, blog posts, and podcasts. Each offers valuable insights, from structuring our metadata into unlocked packages to designing enterprise-scale integrations, all with the aim of making our Salesforce org more modular, maintainable, and aligned to our real-world business domains.

郭全林

Guo Quanlin from Jilin University, Mathematics 86

2 周

These three articles are deeply connected—each building on the idea that architects can evolve beyond system design to embrace a product mindset. If you found one insightful, you’ll likely enjoy the others too. ?? Domain-Driven Design: A Path to Enterprise Salesforce Success https://www.dhirubhai.net/pulse/domain-driven-design-path-enterprise-salesforce-success-charlie-guo-r8ofc/ ?? Why Architects Need Product Vision https://www.dhirubhai.net/pulse/why-architects-need-product-vision-charlie-guo-qcpec/ ?? The Architect’s Evolution from System Designer to Product Leader https://www.dhirubhai.net/pulse/architects-evolution-from-system-designer-product-leader-charlie-guo-4udec/

José García Ponce

Architect at Salesforce

2 周

I am glad to see someone else talking about this. I wrote about this some time back. I am using this in a very complex project. https://medium.com/@josgarca/building-well-architected-solutions-using-domain-driven-design-3bddc84fb09b

Kenneth Wagner

High-impact leadership with a mix of strategy, innovation, and communication. Leading the path to the Agentic Era & Maximising Value from your Data Assets and your Technology.

2 周

Charlie Guo Love your take on this, and while I do agree with most of what you articulate, there's three things I'd love to see unfolded 1) Your visuals, the arrows, does that - to you - indicate which domain needs to be resolved for first, before moving to the next? (Sales > Service > Finance) ? If so, I'd be keen on understanding why, as to my experience, this is highly industry specific AND b2c/B2b/D2c oriented 2) Your visuals/points, while i know it's just visuals, with the More Core movement, I'm keen to see how you think about this when Marketing, Commerce, Order Management (and Revenue Cloud), Tableau Next etc. comes into the mix 3) Shared Kernel -> with the More Core movement, there are more things that are interesting to all domains, as they fuel bespoke processes. Keeping it simple, think about CLTV (Lifetime Value), this is a potential prioritization mechanism for Sales, input that could inform a service process, a segmentation criteria for marketing etc. -> while my example could live neatly on the account, there are other examples like "Campaign Membership" that is domain data, but relevant for the rest. -> how do you think about these things, from a governance POV with more things shared etc? Love your feedback!

Manuel Tejeiro Del Río

Salesforce Architect, Social Impact @ Salesforce

2 周

This is brilliant. Very detailed and explained. Thanks for sharing Charlie Guo. This a must read for any architect and brings a lot of value

Devaraj johnson B

Salesforce B2B Commerce Architect

2 周

Love this very interesting! This concept can be applied not only in orgs but in other places as well. If all the cloud resides in same ORG this world make the organisation of domains much cleaner. But in some cases we have clients having data in multiple ORGs. ex sales in one org commerce in another org. Will it create any issue transferring data back and forth between multiple orgs. Are you saying Domain driven design will be more useful if all resides in one org. Not multiple org. Because if the orgs are already separated this problem can occur but fields are distributed across the orgs so it’s already separated and owned by that governing team. Your thoughts Charlie Guo and Advise on this.

要查看或添加评论,请登录

郭全林的更多文章

社区洞察