Introduction
Look-Up relationship is one of the data types in Salesforce. This data type can create a relationship that links this object to another object. This relationship field allows users to click on a lookup icon to select a value from a pop-up list. The other object is the source of value in the list. If no data is existing in the object you can create a new value by clicking the “create” option.
By reading this article, you will learn about how to create a look-up relationship between two objects in Salesforce.
Prerequisites
-
Before starting this process, you must sign up on the Salesforce Trailhead lightning platform. Click here to
sign up
Step 1
Login to trailhead and launch “trailhead playground” or “Developer Edition”
Step 2
Click the “Gear” icon and then click “Setup” option.
Step 3
In the setup page, click the “Object manager” at the top of the page.
Step 4
Refer to my previous article, how to create a custom object in the Salesforce lightning platform.
In the object manager page, scroll down and click the create our custom object name from the object list.
Step 5
In our created custom object page, click the “Fields & Relationship” option from the left side pane.
Step 6
Next, in the fields and relationship page our predefined fields are listed. Now we are creating a new Look-up relationship from the data type by clicking the “New” button.
Step 7
In the next page, many data types are listed on the page. Select the “Look-Up Relationship” data type radio button and then click the “Next” button.
Step 8
Next, we select the other object from “Related to” Drop down box. Click the dropdown box and select any one of the Salesforce objects and then click the “Next” button.
Step 9
In the details page, enter all the required fields and then click the “Next” button.
Step 10
Next, in the field level security page check if the “Visible” checkbox is checked and then click the “Next” button.
Step 11
Click the “Next” button on the “Add reference field to Page Layouts” page.
Step 12
In Add custom related this page, click the “Save” button to save our created field.
We are automatically forwarded to fields and relationship pages, on the page we can show our created fields name.
We have successfully created both picklist and picklist multi-select data type fields in salesforce.
Let’s test those created fields.
Test Our Created Look-Up Relationship Data Type Field
Step 1
Click the “App launcher” icon at top left corner on the page and then click the “View all” option.
Step 2
The app launcher pop-up window will be opened, search our created object name in the search box and then click the object name.
Step 3
Our object page will be opened, click the “New” button.
Step 4
In the pop-up window, enter all the details in the required field and scroll down to the last. Our created Look-Up Relationship field will be displayed.
Click the lookup icon to create new value in another object.
Other object's pop-up will be opened, enter name and account number on a pop-up and click the “Save” button. These data are stored in another object.
In our Look-Up field, it gets data from another object from the current object.
Summary
Finally, we create a Look-Up Relationship data type field and then created a relationship between two objects successfully.