How to create lookup relationship in salesforce
How to create lookup relationship in salesforce :- Lookup relationship in Salesforce is one type of Object Relationship in Salesforce. In our previous Salesforce Tutorial we have learned about how to create master detail relationship in Salesforce. Lookup relationship is a one to many relationship created between two object and the bonding formed between the object is “loose bonding”.
What is Lookup Relationship in Salesforce.
- Lookup relationship is a one type of relationship which form loose bond relationship between Parent object and Child object.
- In lookup Child record need not be associated to a parent.
- No Cascade record deletion happens.
- Lookup field is not required on the page layouts of the detail object.
- No Rollup summary fields can be created in Lookup relationship.
How to create lookup relationship in salesforce?
To create lookup relationship in salesforce user must navigate to Setup | Build | Create | Object | Child Object (Samples).
Now go to Build | Create | Objects.
- Now select your Child object (Sample).
- Now go to Custom Fields and relationship.
- Now click on New Button as shown above.
Select Lookup Relationship as shown above and click on Next button.
Step 2: -Selecting Related to Object.
Now select Child object in step 2. Here we selected visit as child object Sample object.
Enter Field label, Field Name and click on Next button.
Step 4 :- Establishing Field Level Security for reference field.
Make sure the Field level Security is visible for all profiles. Now click on Save button.
Step 5 :- Select the Page layout for child object field.
- Click on Next button.
Step 6 :- Adding custom related lists.
Click on Save button as shown above. Now successfully we have created lookup relationship in salesforce.
Now open Sample object detail page and we find create lookup relationship between Sample object and Visit object is created in salesforce.
Testing Lookup Relationship in Salesforce
- Go to Sample Object as show below and create a new Sample record.
As shown below In Sample record we have Visit field and the visit field is not mandatory. If we create a record with ut entering visit (lookup field) the record will be saved because lookup relationship forms loose bonding.But in Master detail relationship we can not create a record without entering master detail field because master detail relationship forms tight bonding.
In this Salesforce tutorial we have learned about How to create lookup relationship in salesforce. In our upcoming Salesforce Tutorial we learn about How to create Many to Many relationship in Salesforce.