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:
- Navigate to Setup.
- Select Develop, then click on External Objects.
- Select OrderDetails.
- Locate the orderID field. Click on Edit, then click Change Field Type.
- Choose External Lookup Relationship as its data type. Hit Next.
- Select Orders under the Related to value.
- Type 18 under field length. Leave other options to their default values.
- Click on Next.
- If the field is to be visible to all profiles, tick the checkbox next to Visible. Hit Next.
- A few checkboxes will appear. Do not edit them. They’re supposed to retain their default values.
- 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.