Skip to content

Data Modeling

Data modeling on the Salesforce platform differs from traditional relational database design in fundamental ways. The platform imposes governor limits, sharing model constraints, and relationship rules that shape every design decision. Every modeling choice cascades into security, integration, and performance.

The first decision in any data model: use what Salesforce provides, or build your own.

Standard objects (Account, Contact, Opportunity, Case, Lead) come with built-in features that are expensive to replicate:

  • Pre-built relationships: Account-Contact, Account-Opportunity hierarchies
  • Platform features: Lead conversion, Opportunity forecasting, Case escalation, Email-to-Case
  • AppExchange compatibility: Most packages expect standard objects
  • Standard reports and dashboards: Out-of-the-box analytics
  • Mobile and Lightning optimizations: Standard objects have dedicated page layouts and Lightning components
  • Process automation: Pre-built approval processes, assignment rules, escalation rules

Custom objects make sense when:

  • No standard object fits the business concept (e.g., Project, Inventory Item, Policy)
  • Full control over field-level security is needed without fighting inherited permissions
  • The entity has no overlap with standard object behavior
  • A standard object would be polluted with unrelated fields (e.g., cramming warehouse data into Account)
FactorStandard ObjectCustom Object
Built-in featuresYes - lead conversion, forecasting, etc.Must be built manually
AppExchange integrationSmoothMay require mapping
Governor limitsSlightly higher in some casesStandard limits apply
Customization freedomLimited by existing fields/behaviorFull control
Sharing modelMay inherit complex defaultsClean slate
ReportingPre-built reports availableCustom report types needed

Relationships in Salesforce are not just foreign keys. They drive sharing, roll-ups, deletion behavior, and query structure. Choosing the wrong relationship type is one of the most costly data modeling mistakes.

Decision tree selecting between lookup and master-detail based on child independence, roll-up needs, sharing inheritance, and reparenting requirements.
Figure 1. Five criteria drive the lookup vs master-detail decision: child independence, roll-up summary need, sharing inheritance requirements, reparenting flexibility, and cascade delete behavior. Getting this wrong after data is populated is costly to reverse.
BehaviorDetail
Cascade deleteDeleting the master deletes all detail records
Sharing inheritanceDetail inherits sharing from master; no independent sharing rules
Roll-up summariesCOUNT, SUM, MIN, MAX on detail records
Owner fieldDetail record has no OwnerId; ownership follows master
Required fieldMaster-detail field is always required
ReparentingOff by default; can be enabled but rarely recommended
Limit2 master-detail relationships per object
BehaviorDetail
Cascade deleteNo cascade; child record becomes orphaned (lookup field set to null)
SharingIndependent sharing model; child has its own OwnerId
Roll-up summariesNot natively supported (use triggers, DLRS, or Flow)
Required fieldOptional by default; can be made required
ReparentingAlways allowed
Limit40 total relationships per object (combining lookups and master-detail; the 2 MD relationships count toward the 40 total)

Only available on User object. Used for approval processes, role hierarchy, and manager chains. Relevant for CTA scenarios involving approval routing or reporting structures.

Link standard/custom objects to External Objects. The relationship is based on an External ID rather than a Salesforce record ID. Critical for Salesforce Connect architectures.


When two objects have a many-to-many relationship, a junction object with two master-detail relationships is required.

Entity relationship diagram showing a junction object with two master-detail relationships bridging a student and course many-to-many relationship.
Figure 2. A junction object holds two master-detail relationships, one to each parent, enabling a native many-to-many relationship on the platform. The first master-detail created determines the primary sharing model for the junction records.
  • The junction object has two master-detail relationships, each pointing to one side of the M:N
  • The first master-detail (created first) determines the primary relationship and sharing model
  • The junction object can have its own fields (enrollment date, status, grade)
  • Deleting either master deletes the junction record
  • Related lists appear on both parent objects

Polymorphic lookups point to multiple object types. Salesforce has built-in polymorphic fields:

FieldObjectPoints To
WhoIdTask, EventContact OR Lead
WhatIdTask, EventAccount, Opportunity, Case, Custom Objects, etc.
OwnerIdMost objectsUser OR Queue
RelatedToIdEmailMessageMultiple objects
  • SOQL complexity: You must use TYPEOF in SOQL to handle polymorphic fields:
    SELECT Id, Subject,
    TYPEOF Who
    WHEN Contact THEN FirstName, LastName, Account.Name
    WHEN Lead THEN FirstName, LastName, Company
    END
    FROM Task
  • Reporting limitations: Polymorphic fields create complex report type requirements
  • Trigger design: Apex triggers must handle multiple object types in the same field
  • You cannot create custom polymorphic lookups: only Salesforce-defined ones exist

External Objects represent data stored outside Salesforce (in external systems accessed via Salesforce Connect).

FeatureStandard/Custom ObjectsExternal Objects
Data storageOn-platformExternal system
Governor limitsStandard limitsCallout-based limits
SOQLStandard SOQLLimited SOQL subset
TriggersFull trigger supportLimited (via Change Data Capture change event triggers only)
Workflows/FlowsFull supportLimited
RelationshipsLookup, MDExternal lookup, indirect lookup
Real-time dataYes (stored)Yes (live query)

Big Objects store and manage massive datasets (billions of records) on the Salesforce platform. Two types exist:

  • Standard Big Objects: FieldHistoryArchive, etc.
  • Custom Big Objects: Defined with __b suffix
FeatureBig ObjectsStandard/Custom Objects
Record countBillionsMillions (with LDV concerns)
SOQLStandard SOQL on indexed fields only (Async SOQL retired Summer 2023 — use Batch Apex or Bulk API)Standard SOQL
DMLdatabase.insertImmediate()Standard DML
IndexesDefined at creation (immutable)Configurable
TriggersNot supportedFull support
ReportingNot supported (query into custom objects)Full support
RelationshipsCannot be child in MDFull support
  • Audit trail archival: Move old FieldHistoryArchive records
  • Historical data: Transaction history, log data, IoT telemetry
  • Data archival: Move aged records from standard objects to preserve performance

Record types enable different business processes, page layouts, and picklist values on the same object.

  • Different user groups need different page layouts on the same object
  • Different picklist values per business process (e.g., Case types for Support vs Engineering)
  • Different sales processes for Opportunity (e.g., New Business vs Renewal)
  • Different Lead conversion mappings per business unit
  • Just to filter list views (use list view filters instead)
  • When a custom field with values would suffice
  • When fundamentally different data models call for separate objects

Person Accounts merge Account and Contact into a single record for B2C scenarios. This is one of the most consequential data modeling decisions on the platform.

Decision tree evaluating B2C requirements, existing Account-Contact usage, and integration impact before recommending the irreversible Person Accounts enablement.
Figure 3. Person Accounts enablement is permanent and org-wide. The decision turns on whether individuals genuinely need Account-level features such as teams, hierarchy, or entitlements, and whether existing code and integrations can absorb the change.

Person Accounts are not a new object type. They are a dual-nature entity that creates both an Account record and a Contact record simultaneously. Understanding this internal structure is critical for integration and Apex development.

Diagram revealing that a Person Account creates both an Account record and a Contact record internally, kept in sync automatically, with distinct field sets on each side.
Figure 4. A Person Account is not a new object type. It is a dual-record structure where one Account and one Contact are created and kept in sync automatically. APIs querying Contacts will return Person Account contact records, so integrations must filter on IsPersonAccount.
AdvantageDisadvantage
Natural B2C data modelIrreversible once enabled
Unified record for individualBreaks Account-Contact assumptions in code
Account features for individuals (teams, hierarchy)Many AppExchange packages incompatible
Simplifies data model for B2CComplicates B2B+B2C hybrid orgs
Person Account record type distinguishes B2C from B2BIntegration complexity increases

Formula fields are powerful but consume resources. Key limits:

LimitValue
Formula field character limit3,900 characters (compiled size 5,000)
Cross-object referencesUp to 10 unique relationships per object (spanning relationships)
Formula fields per objectNo hard limit, but impacts performance
SOQL and formula interactionFormulas cannot be used in WHERE clauses
  • Formula fields are calculated at read time, adding computation to every query
  • Cross-object formulas create implicit dependencies that affect deployment order
  • Deterministic formulas (no NOW(), TODAY()) can be indexed, which matters for LDV
  • Heavy formula usage on LDV objects degrades list view and report performance

Roll-up summary fields aggregate child records in a master-detail relationship.

  • COUNT: Count of detail records
  • SUM: Sum of a numeric field
  • MIN: Minimum value
  • MAX: Maximum value
ConstraintLimit
Roll-ups per object10 per object by default (can be increased to 25 via Salesforce Support)
Filter criteriaSupported (count WHERE Status = ‘Closed’)
Cross-object formulasCan reference roll-up values
Supported relationshipsMaster-detail only (native)

For lookup relationships, alternatives include:

  • Declarative Lookup Roll-up Summaries (DLRS): Open-source AppExchange package
  • Flow-based roll-ups: Record-triggered flows with aggregation
  • Apex triggers: Custom roll-up logic with bulkification
  • Salesforce native (beta): Roll-up on lookup is evolving

Entity relationship diagram for a standard B2B sales model covering Account, Contact, Opportunity, Products, Quotes, Cases, Contracts, and Orders with standard Salesforce relationships.
Figure 5. The classic B2B sales data model using standard Salesforce objects. Standard objects carry pre-built features (lead conversion, forecasting, case escalation) that custom objects must replicate from scratch, so this model should be the default starting point for any sales scenario.
Entity relationship diagram for Service Cloud showing Cases linked to Contacts, Knowledge Articles, Entitlements, Email Messages, and Milestones for SLA tracking.
Figure 6. Service Cloud adds Entitlements, Milestones, and Knowledge Article linkage on top of the standard Account-Contact-Case model. Entitlements govern which SLA terms apply per account, while Milestones track whether response and resolution time targets are being met.

Custom Multi-Tenant Model (Common CTA Scenario)

Section titled “Custom Multi-Tenant Model (Common CTA Scenario)”
Entity relationship diagram for a multi-tenant partner model covering Partner Accounts, Deal Registrations, MDF Requests, and their conversion paths to Opportunities.
Figure 7. A partner channel data model links Partner Accounts and their users to Deal Registrations and MDF funding requests. Deal Registrations convert to Opportunities, allowing channel revenue to be tracked through the standard sales pipeline.
Entity relationship diagram for a B2C model using Person Accounts with Orders, Cases, Activities, Consent records, and a Loyalty program with transaction history.
Figure 8. The B2C data model centers on Person Accounts, which combine Account-level features (teams, hierarchy, entitlements) with individual consumer identity. Consent and Loyalty objects are common additions in retail and financial services implementations.

In a B2B2C model, a business sells through another business to reach consumers. The data model must accommodate both the B2B partner relationship and the B2C consumer relationship.

Entity relationship diagram for a B2B2C architecture where Business Accounts operate Storefronts that serve Person Account consumers, with both B2B contracts and B2C orders coexisting.
Figure 9. The B2B2C hybrid model requires Person Accounts enabled org-wide so both Business Accounts (B2B) and Person Accounts (B2C consumers) coexist. Record types on Account distinguish the two populations, while Storefront bridges the business seller and the consumer buyer.

Cramming unrelated data into a single object (usually Account or a “master” custom object). This leads to:

  • Field count approaching 800 limit
  • Confusing page layouts
  • Security and sharing nightmares
  • Deployment conflicts between teams

Creating too many objects with narrow responsibilities. On Salesforce, joins are expensive (SOQL limits), and every relationship adds query complexity. Balance normalization with platform realities.

Choosing lookup when master-detail is needed for sharing, or vice versa. A lookup relationship means the child has its own sharing model. If children must inherit parent sharing, use master-detail.

Adding record types after data is populated requires backfilling all existing records. Plan record types during initial design.

Creating A -> B -> C -> A master-detail chains. Salesforce prevents this, but architects sometimes try to work around it with mixed lookup/MD chains, creating confusing ownership and sharing models.


  • Sharing Model: master-detail vs lookup determines sharing inheritance and OWD impact
  • Field & Object Security: field-level security and object permissions constrain data model design
  • Integration Patterns: object structure affects API payloads, ETL field mapping, and external ID strategy
  • Large Data Volumes: relationship type and formula fields affect query performance at scale
  • Data Migration: relationship order dictates migration load sequence
  • Development Lifecycle: record types and custom objects affect change management and deployment complexity
  • Org Strategy: data model complexity influences single-org vs multi-org decisions

Personal study notes for the Salesforce CTA exam. Content compiled from VJ's study notes, official Salesforce documentation, community sources, and online publicly available content, then organized and presented with AI assistance. Not affiliated with Salesforce. © 2025–2026 VJ Srivastava.