Lookup Field
A Lookup Field in Salesforce is a relationship field type that creates a soft link between two records, storing the parent record''s ID on the child.
Definition
A Lookup Field in Salesforce is a relationship field type that creates a soft link between two records, storing the parent record''s ID on the child. Unlike Master-Detail relationships, a Lookup is a soft foreign key: the child can exist without a parent (the lookup field can be blank or set to null), the child has its own sharing model, and deleting the parent does not cascade to children by default. Lookup Fields are the most common relationship type on Salesforce custom objects and the foundation of nearly every standard parent-child link (Opportunity.AccountId, Contact.AccountId, Case.ContactId).
Lookup Fields produce the magnifying-glass-icon picker in the UI, render as a clickable link to the parent record on display, and expose the relationship via SOQL relationship queries (SELECT Account.Name FROM Opportunity). Admins create lookup fields under Setup, Object Manager. The lookup field type is the default choice for most cross-object relationships; pick Master-Detail only when the child has no meaning without the parent and you want cascade-delete and shared sharing.
Lookup Field semantics and when to choose them over Master-Detail
Soft foreign key behavior
A Lookup Field stores the parent''s ID but allows the link to be optional. The child record can exist with a blank lookup field (unless the admin marks it required). Deleting the parent triggers one of three configurable behaviors on the lookup: Don''t Allow Deletion, Clear the Lookup Field (default), or Cascade Delete. The default Clear behavior means the lookup goes blank but the child survives.
Lookup vs. Master-Detail
Master-Detail relationships are hard foreign keys: the child cannot exist without the parent, deleting the parent cascades to the child, and the child inherits the parent''s sharing. Lookup Fields are the opposite: optional, configurable cascade behavior, and independent sharing. Pick Master-Detail when the child has no meaning without the parent (Invoice Line on Invoice). Pick Lookup when the child can exist independently (Contact under Account).
Polymorphic Lookups
Some standard lookup fields are polymorphic: they can point to records of different objects. Task.WhatId is the canonical example, storing the ID of an Account, Opportunity, Case, or other allowed object. SOQL handles polymorphic lookups with the TYPEOF clause; Apex resolves them at runtime by inspecting the ID prefix. Custom lookup fields are not polymorphic by default; they target one specific object.
Lookup Filters
Admins can add Lookup Filters to a lookup field to scope the dialog''s search results. A filter like Account.Type = ''Customer'' restricts the lookup dialog to customer accounts. Lookup Filters are the standard tool for preventing users from picking the wrong record; they save data-quality cleanup later.
Cascade delete behavior
Lookup Fields support three parent-delete behaviors: Don''t Allow Deletion of the parent (blocks the deletion), Clear the Lookup Field (default; the child survives without the parent), and Cascade Delete (delete the child too; only available on certain standard objects via Salesforce Support). The choice is set at field-creation time and changeable in most cases.
SOQL relationship queries
Lookup Fields enable upward SOQL traversal with dot notation: SELECT Name, Account.Name, Account.Owner.Email FROM Contact. Up to five levels of upward traversal are supported. Downward (parent-to-children) traversal uses subqueries: SELECT Name, (SELECT Name FROM Contacts) FROM Account.
Indirect and External Lookups
Indirect Lookup is a special variant for External Objects (Salesforce Connect). It matches an external field on the parent to a value stored on the child, without storing a Salesforce ID. External Lookup is similar but for external-to-external relationships. Both are advanced features used in Salesforce Connect-based integrations.
Create a Lookup Field on a custom object
Lookup Field creation is a few clicks. The decisions (parent object, cascade behavior, lookup filter) matter more than the click path.
- Open Fields & Relationships
Setup, Object Manager, the child object, Fields & Relationships, click New.
- Choose Lookup Relationship
Pick the Lookup Relationship field type. Master-Detail is for hard parent-child; Lookup is for the soft version.
- Pick the parent object
Choose which object the lookup points to. Multiple lookups to the same parent are supported.
- Set field label, name, and required flag
Enter the field label and API name. Decide whether the lookup is required.
- Configure parent-delete behavior
Pick Don''t Allow Deletion, Clear the Field, or Cascade Delete. Default is Clear.
- Add a lookup filter if needed
Configure lookup filter criteria to scope the dialog''s search results.
- Add to page layouts and FLS
Place the field on the relevant page layouts. Configure field-level security per profile.
Lookup Relationship.
The target of the lookup.
User-facing name and programmatic identifier.
Decides what happens to the child if the parent is deleted.
Narrows the dialog''s search scope.
- Lookup Fields are soft links. Children survive parent deletes by default (Clear behavior); the cascade behavior is configurable but defaults to soft.
- Polymorphic lookups (Task.WhatId, Event.WhatId) cannot be queried with dot notation across all parent types. Use TYPEOF for polymorphic queries.
- Lookup filters can be too restrictive. Test the filter against real user scenarios; over-filtering blocks legitimate workflows.
- Converting Lookup to Master-Detail is possible only when every child record has a populated parent. Required-from-day-one Lookup fields convert cleanly; optional ones often don''t.
Trust & references
Cross-checked against the following references.
- Object RelationshipsSalesforce Help
- Lookup FiltersSalesforce Help
Straight from the source - Salesforce's reference material on Lookup Field.
- Relationships Among ObjectsSalesforce Developers
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Test your knowledge
Q1. What is a Lookup Field?
Q2. How does Lookup differ from Master-Detail?
Q3. When should you use Lookup over Master-Detail?
Discussion
Loading discussion…