# Data modeling: objects, relationships and external IDs

*Platform Developer Study Guide · Developer Fundamentals · Last updated October 15, 2026 · https://www.certifyforce.com/study-guide/platform-developer/developer-fundamentals/data-modeling-objects-relationships-schema*

Choosing lookup, master-detail, junction, hierarchical, external lookup or indirect lookup relationships from a requirement, using external IDs for upserts, and reading schema, picklists and record types from Apex with describe calls.

- Certification: Salesforce Platform Developer
- Exam section: Developer Fundamentals
- Study guide: https://www.certifyforce.com/study-guide/platform-developer

**Official exam objective:**

> Given a scenario, determine, create, and access the appropriate data model including objects, fields, relationships, and external IDs.

## What the exam expects

- Pick the relationship type from a requirement: lookup, master-detail, many-to-many junction, self lookup, hierarchical, external lookup or indirect lookup.
- Predict master-detail behaviour (required parent, cascade delete, inherited sharing, roll-ups) and the rules for converting and reparenting.
- Design external ID fields for integrations and upserts.
- Build and inspect the model with Schema Builder, and read objects, fields, picklist values and record types from Apex with describe.
- Key terms: **lookup** (loose link, parent optional); **master-detail** (tight link, master controls the detail); **junction object** (a custom object with two master-detail relationships); **external ID** (a field holding another system's record identifier); **describe** (Apex metadata about objects and fields).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Master-detail per object | Up to 2, within 40 total relationships | [Object Relationships Overview](https://help.salesforce.com/s/articleView?id=platform.overview_of_custom_object_relationships.htm&type=5) |
| Detail record owner | No Owner field; set to the master's owner; no sharing rules, manual sharing or queues | [Object Relationships Overview](https://help.salesforce.com/s/articleView?id=platform.overview_of_custom_object_relationships.htm&type=5) |
| Lookup parent deleted | Default clears the field; can block deletion instead | [Object Relationships Overview](https://help.salesforce.com/s/articleView?id=platform.overview_of_custom_object_relationships.htm&type=5) |
| Master-detail to lookup | Only when no roll-up summary fields exist on the master | [Considerations for Object Relationships](https://help.salesforce.com/s/articleView?id=platform.relationships_considerations.htm&type=5) |
| Lookup to master-detail | Only when every record has a lookup value | [Considerations for Object Relationships](https://help.salesforce.com/s/articleView?id=platform.relationships_considerations.htm&type=5) |
| Junction primary relationship | First master-detail created; drives look and feel and owner | [Considerations for Object Relationships](https://help.salesforce.com/s/articleView?id=platform.relationships_considerations.htm&type=5) |
| External ID field types | Auto-number, email, number, text; up to 25 per object | [Custom Field Attributes](https://help.salesforce.com/s/articleView?id=sf.custom_field_attributes.htm&type=5) |
| Upsert key | Indexed external ID custom field (or idLookup field on standard objects) | [upsert()](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_upsert.htm) |
| Hierarchical relationship | User object only | [Object Relationships Overview](https://help.salesforce.com/s/articleView?id=platform.overview_of_custom_object_relationships.htm&type=5) |
| Active picklist values in Apex | `getPicklistValues()` then `isActive()` on each entry | [PicklistEntry Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_PicklistEntry.htm) |

## Check yourself

- Why can't a detail object have sharing rules?
- When can a lookup be converted to master-detail?
- Which relationship do you create when a Salesforce Connect object stores an ERP code that must match an Account?
- Why describe a picklist field instead of querying records for its values?
- Which field types can be marked as external IDs?

## Sources

- [Object Relationships Overview](https://help.salesforce.com/s/articleView?id=platform.overview_of_custom_object_relationships.htm&type=5)
- [Considerations for Object Relationships](https://help.salesforce.com/s/articleView?id=platform.relationships_considerations.htm&type=5)
- [Object Relationships: Create & Manage](https://trailhead.salesforce.com/content/learn/modules/data_modeling/object_relationships)
- [Custom Field Attributes](https://help.salesforce.com/s/articleView?id=sf.custom_field_attributes.htm&type=5)
- [upsert()](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_upsert.htm)
- [Relate External Objects Using External IDs](https://help.salesforce.com/s/articleView?id=sf.relate_external_objects.htm&language=en_US&type=5)
- [Data Model](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/data_model.htm)
- [Design Your Own Data Model With Schema Builder](https://help.salesforce.com/s/articleView?id=platform.schema_builder.htm&type=5)
- [Understanding Apex Describe Information](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm)
- [PicklistEntry Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_PicklistEntry.htm)
- [DescribeSObjectResult Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject_describe.htm)
- [Tailor Business Processes to Different Record Types Users](https://help.salesforce.com/s/articleView?id=platform.customize_recordtype.htm&type=5)
- [Contacts to Multiple Accounts](https://help.salesforce.com/s/articleView?id=sales.shared_contacts_overview.htm&type=5)
- [What Is a Cross-Object Formula?](https://help.salesforce.com/s/articleView?id=platform.customize_cross_object.htm&type=5)
- [Understanding Relationship Names](https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-relationships-understanding.html)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 21 linked practice questions, and unlimited timed mock exams are included with the Platform Developer pack (USD $19): https://www.certifyforce.com/practice-exams
