Skip to main content

SF-0029 · Concept · Easy

What is lookup relationship?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026

A lookup relationship in Salesforce is a loose link from one object to another. The child references the parent, but the two records remain independent in ownership, sharing, and lifecycle. Lookup is the default relationship type when you need an object to “point to” another but don’t want the strict coupling of master-detail.

What a lookup gives you

When you create a lookup field on object A pointing to object B:

  • A new field of type Reference appears on A storing B’s record Id
  • A related list (optional) appears on B’s page layout showing all A records that point to B
  • Cross-object SOQL becomes possible: SELECT Name, Account__r.Name FROM My_Object__c
  • Cross-object formulas become possible: Account__r.Industry
  • You can use the lookup field in validation rules, flows, reports, and page layouts

What a lookup does not give you

This is where lookup differs from master-detail:

BehaviorLookupMaster-Detail
Required by defaultNo (configurable)Yes
Child has own ownerYesNo — inherits master
Child has own sharingYesNo — controlled by parent
Cascade delete when parent deletedNo (configurable)Yes
Roll-up summary on parentNoYes
Standard object as childAllowedRestricted
Per-object limit40 (combined w/ M-D)2

Lookup configuration options

When creating a lookup, Salesforce asks “What to do if the lookup record is deleted?”:

  1. Clear the value of this field. (default) — the child stays, the lookup is set to null.
  2. Don’t allow deletion of the lookup record that’s part of a lookup relationship. — Salesforce blocks the parent delete if any child references it.
  3. Delete this record also. — cascades the delete to the child. This option only appears if the lookup is required and the relationship is on a custom object pointing to a standard or custom object (with restrictions).

You can also mark the lookup Required at the field level, which approximates one of master-detail’s behaviors (parent must always exist) without coupling sharing.

When to use lookup vs master-detail

Use lookup when:

  • The child is meaningful on its own (Opportunity → Account: an Account exists without Opportunities)
  • The child needs its own owner and sharing (Cases owned by support reps, Accounts owned by sales reps)
  • The child might temporarily have no parent (during data load, manual cleanup)
  • Either side might be standard objects that can’t be the child of a master-detail

Use master-detail when:

  • The child is a part of the parent (line items, comments, attachments)
  • You need cascade delete
  • You need roll-up summary fields
  • The child’s sharing should follow the parent’s

Lookup field examples

Standard relationships that are lookups (not master-detail):

  • Opportunity.AccountId → Account
  • Contact.AccountId → Account
  • Case.AccountId, Case.ContactId → Account / Contact
  • Lead.OwnerId → User
  • Task.WhatId, Task.WhoId → polymorphic lookup to multiple object types

These are intentionally lookups because each side has independent ownership and lifecycle.

Lookup filters

Lookups support lookup filters — admin-defined rules that restrict which records can be selected in the lookup picker. For example:

“On Opportunity.AccountId, only allow Accounts where Account.Status = 'Active'.”

Lookup filters can be required (hard block) or optional (a “Show all results” link). They prevent bad data at entry time and are an underused governance tool.

Converting between types

You can convert lookup → master-detail if every existing child record has a non-null value in the lookup. Conversely, you can convert master-detail → lookup, but you must first delete any roll-up summary fields that depend on it.

A practical pattern

Modeling Vendor and Purchase Order in a custom app:

  • Vendor__c — independent custom object, owners can be procurement reps
  • Purchase_Order__c with a lookup to Vendor__c (Required = true)
  • If a vendor must never be deleted while POs reference them, set the lookup option to “Don’t allow deletion”

This keeps PO ownership separate from Vendor ownership while preserving referential integrity.

Verified against: Salesforce Help — Lookup Relationships. Last reviewed 2026-05-17.