How to Use the Lookup Relationship in Salesforce

How to Use the Lookup Relationship in Salesforce

Lookup is a type of Salesforce relationship that connects two objects together without affecting security and deletion properties. Creating an intermediary relationship between objects is possible by adding lookup relationships to standard, custom and external objects.

Understanding Lookup Relationships

A lookup relationship field connects a child object to a parent object. The relationship can be added to standard, external and custom objects for child records; and standard and custom objects for parent records.

A child record with a lookup relationship contains a lookup icon which, when clicked, will display its parent record. Conversely, when a parent record’s lookup icon is viewed, users are able to check the related list of child records under it.

Lookup fields are not automatically required, as in the case of master-detail and many-to-many relationships. The security and access of the objects linked through a lookup is not affected by each other. One object could get deleted, while the other one remains intact. Linked objects can be accessed either separately or jointly. This is to protect the data from accidental edits and deletions.

Creating External Lookup Relationships

This example links a particular object to an external object. Here are the steps to do it:

  1. Navigate to Setup.
  2. Select Develop, then click on External Objects.
  3. Select OrderDetails.
  4. Locate the orderID field. Click on Edit, then click Change Field Type.
  5. Choose External Lookup Relationship as its data type. Hit Next.
  6. Select Orders under the Related to value.
  7. Type 18 under field length. Leave other options to their default values.
  8. Click on Next.
  9. If the field is to be visible to all profiles, tick the checkbox next to Visible. Hit Next.
  10. A few checkboxes will appear. Do not edit them. They’re supposed to retain their default values.
  11. Click on Save.

Notice that a new OrderDetails related list becomes visible under the Order page. An external lookup relationship is now created between OrderDetails and the OrderID field.

Leave a Reply

Close Menu