Skip to content
Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryLLookup Field
Core CRMAdvanced

Lookup Field

A Lookup Field in Salesforce is a relationship field type that links two objects by storing the parent record's ID on the child record.

§ 01

Definition

A Lookup Field in Salesforce is a relationship field type that links two objects by storing the parent record's ID on the child record. It creates a loose connection, so the child can exist whether or not the lookup is filled in, the child keeps its own ownership and sharing, and deleting the parent does not delete the child by default. Lookups are the most common way to relate records on the platform, and they back nearly every standard parent-child link, including Opportunity to Account, Contact to Account, and Case to Contact.

In the user interface a Lookup Field shows a search picker (the magnifying-glass icon), then renders as a clickable link to the parent record. The relationship is queryable in SOQL with dot notation, such as SELECT Account.Name FROM Opportunity. Admins create lookup fields under Setup, Object Manager, by adding a field of type Lookup Relationship. It is the default choice for cross-object links. You pick Master-Detail instead only when the child has no meaning without its parent and you want cascade delete and inherited sharing.

§ 02

How Lookup Fields connect records

The soft foreign key

A Lookup Field stores the parent record's ID, but the platform treats that link as optional and loosely coupled. The child can be saved with the lookup left blank, unless the admin selects the option that makes the field required. Because the link is soft, the child carries its own owner and its own sharing rules. It does not inherit visibility from the parent the way a master-detail child does. This independence is the main reason to choose a lookup. A Contact can belong to an Account, yet the Contact still has its own owner, its own access, and its own life span. When the related parent record is deleted, the platform applies one of three configured behaviors to the lookup rather than always cascading. The default behavior clears the field, so the child survives with an empty lookup. This soft model keeps your data flexible, since you can relink, blank out, or reassign records without the rigid constraints that a hard relationship imposes. It is the safer default when you are not certain the child should be permanently bound to one parent.

Lookup versus Master-Detail

Lookup and Master-Detail are the two relationship types you create on Salesforce objects, and they sit at opposite ends of a coupling scale. A master-detail child is tightly bound: its value is required, deleting the master deletes the detail through cascade delete, and the detail inherits the master's ownership and sharing. Lookups support none of that automatically. A lookup child can be optional, it has independent ownership and sharing, and it is not deleted with the parent by default. One practical consequence is roll-up summary fields. Those summarize child records onto a parent, and Salesforce only allows them on master-detail relationships, not on plain lookups. If you need a rolled-up count or sum and you have a lookup, you reach for a different tool such as a flow, Apex, or a declarative rollup app. Choose Master-Detail when the child has no meaning on its own, like an invoice line under an invoice. Choose Lookup when the child can stand alone, like a Contact under an Account. Converting a lookup to master-detail later is possible only if every child record has a value in the field.

What happens when the parent is deleted

When you build a lookup, you decide what should happen to the child if the parent record is deleted. Salesforce offers three behaviors. The first, Clear the value of this field, is the default and the gentlest. The child stays, and its lookup simply goes blank. The second, Don't allow deletion of the lookup record that's part of a lookup relationship, blocks the parent delete entirely while any child still points to it. That guard is useful when orphaned children would be a data-quality problem. The third, Delete this record also, cascades the delete down to the child. Salesforce warns that this cascade bypasses security and sharing settings, so a user can trigger the deletion of child records they would not otherwise be able to delete. For that reason the cascade option is disabled by default and is offered only in limited cases, often after Salesforce enables it. You set the behavior at field creation time on optional lookups, and you can usually change it later. Picking the right behavior up front saves cleanup work and avoids surprise data loss during routine deletes.

Scoping the picker with Lookup Filters

Out of the box a lookup picker searches every record of the target object, which often shows users records they should never pick. A Lookup Filter narrows that search. It is a rule you attach to the lookup field that limits which records appear in the picker and which the field will accept. A filter such as Account Type equals Customer restricts an Account lookup to customer accounts only. Filters can compare the lookup target to a static value, to another field on the same record, or to a field on the running user, which makes them flexible enough to enforce real business rules. You can set a filter as required, which hard-blocks any record that fails the rule, or as optional, which only suggests matching records but still lets users override. Lookup Filters are the standard, no-code way to keep relationships clean. They prevent the wrong-record problem at entry time instead of forcing you to fix mismatched data afterward. The catch is testing. A filter that looks correct to an admin can quietly block a legitimate scenario, so validate it against the real ways users create and edit records.

Querying lookups in SOQL

Lookups are the backbone of relationship queries. To read fields from a parent, you use child-to-parent dot notation. SELECT Name, Account.Name, Account.Owner.Email FROM Contact walks up from Contact to its Account and then to that Account's owner. Salesforce lets a single child-to-parent path go up to five levels deep in API version 58.0 and later. Earlier API versions capped that at two levels, so the depth you can use depends on the API version your query runs against. A single query can also include a large number of these parent paths, up to 55 child-to-parent relationships. Going the other direction, from a parent down to its children, uses a subquery, like SELECT Name, (SELECT LastName FROM Contacts) FROM Account. Custom relationships are referenced with the __r suffix in the relationship name, while standard relationships usually use the singular object name. Understanding this traversal matters well beyond raw SOQL, because formula fields, report types, list views, and roll-up tools all rely on the same lookup paths. A clean lookup design makes every one of those downstream features simpler to build.

External and Indirect Lookups

Beyond the standard lookup, Salesforce offers two relationship types built for external objects, which surface data from outside systems through Salesforce Connect. An External Lookup links a child to a parent external object by matching the parent's External ID. An Indirect Lookup links a child external object to a parent standard or custom object, and you use it when the external data has no Salesforce record IDs to match on. With an indirect lookup, you pick a custom field on the parent that is marked unique and is an external ID, and Salesforce matches the child's stored value against it. These variants let you weave records from an external database into related lists and reports without copying that data into Salesforce. They are advanced features, mostly seen in integration projects, but they show how far the lookup concept stretches. The same idea, a child pointing to a parent through a stored value, scales from one custom object referencing another all the way to a live external table. For most everyday work, though, the plain Lookup Relationship is the one you will create again and again.

§ 03

How to create a Lookup Field

Create a Lookup Field from Object Manager when you want to relate a record on one object to a record on another, without the tight coupling of a master-detail relationship. The flow below covers the standard path for a custom or standard object.

  1. Open the object in Object Manager

    In Setup, go to Object Manager and select the child object, the one that will store the link. Click Fields and Relationships, then New.

  2. Choose the Lookup Relationship type

    On the data type screen, select Lookup Relationship and click Next. Then pick the related object, the parent that records will point to, and continue.

  3. Label and configure the field

    Enter the Field Label and let the name auto-fill. Optionally make the field required, and add a Lookup Filter if you want to restrict which parent records users can pick.

  4. Set the delete behavior

    For an optional lookup, choose what happens when the parent is deleted: clear the field, block the deletion, or cascade delete the child where that option is offered.

  5. Add to layouts and save

    Set field-level security, add the field to the page layouts that need it, choose which related lists show the child records, then save.

Field Labelrequired

The user-facing name of the lookup field shown on layouts and in the picker.

Related To (parent object)required

The object whose records this lookup points to; chosen on the data type step and not changeable after creation.

Field Name (API name)required

The internal name used in code and integrations; auto-derived from the label but editable before saving.

Gotchas
  • Roll-up summary fields do not work on plain lookups; you need a master-detail relationship, or a flow or Apex, to summarize child records onto the parent.
  • Each custom object allows up to 40 relationship fields total, counting master-detail and lookup together, so plan the schema before you hit the cap.
  • Cascade delete (Delete this record also) bypasses sharing and security, is disabled by default, and is often only available after Salesforce enables it.
  • Converting a lookup to master-detail later requires that every existing child record already has a value in the lookup field.

Prefer this walkthrough as its own page? How to Lookup Field in Salesforce, step by step

§

Trust & references

Sources

Cross-checked against the following references.

Official documentation

Straight from the source - Salesforce's reference material on Lookup Field.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.

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 the default behavior of a Lookup Field on the child record when its parent record is deleted?

Q2. Which standard lookup field is polymorphic, able to point to records of several different objects?

Q3. How many levels of upward relationship traversal does SOQL support through Lookup Fields with dot notation?

§

Discussion

Loading…

Loading discussion…