Salesforce lookup relationship has no relation with other records. It does not depend on any other objects, whereas a master-detail relationship has an association with other records.
Let us consider this with an example: Think of the “Agent’s Table”. It has few header data which are “Manager Assigned” and the “Agent name”. It also has more fields other than the above, for agent declaration such as “ID, First Name, Second Name”, etc. The ‘master’ Manager record holds the data of the header too. The others hold the agent declaration fields. Every other area has to connect to other master records. And the “Agent” has the master-detail relationship with the “Manager table
On the other hand, the lookup relationship is just a reference. It can be even blank or NULL. In the database, we can pull the data from particular fields based on the reference keys easily. Same way in Salesforce, the object reference is the basic segmentation in the data relationships.
What is the relationship?
Connecting different objects with each other to replicate a real-life scenario/business process is called a relationship.
How to connect objects in Salesforce?
In the following ways Salesforce connects the Objects:
- Lookup relationship.
- Master-detail relationship.
- Many to many relationships.
- Hierarchical relationship.
How to create Lookup Relationship in Salesforce?
Let us proceed with an example of an explanation of the relationship between “Objects”. Let us consider the manager & agent relationship in sales (For Lookup relationship).
Step1: Identify 2 “Objects”.
Step2: Decide on which Object the relationship should be, eg: Agent.
Note: Please follow the steps from Article: Salesforce App Development, Data Modeling in Salesforce and create necessary “Objects” including fields in it.
Step3: Decide the relation type - (eg: lookup relationship)
Step4: Create a relationship field.
How to create a Relationship Field?
After login to “Salesforce Org” >> Select the required app in the top right corner.
After selecting the desired app (eg: relationship app), Go to “Agents” Object which is already created, and select it. To the right of the screen, we have “Quick Access Menu” >> click on it and select “Fields”. Now, we can enter a new field to it with the “New” button.
Subscribe to our youtube channel to get new updates..!
After Selecting “New” >> Step1: Choose the field type >> select “Lookup Relationship” next
Step2: Select “Related To” (for which field the “Agent Object” should be connected for relationship). >> Select “Managers” >> next.
Step3: Enter the details or rename the field based on the requirement (eg: Manager Assigned) >> next.
Step4: In this step, the access for the profiles is granted based on the requirement.
Step5: In this step, by default “The page layout” will be in selection (eg: Student Layout) >> next.
Step6: In this step, the list display for managers is added for the Object - “Agents”. We can rename the “Related List Label” - (eg: Agents List).
Now, add entries in the “Agents Object” where you can find the managers list to add for the particular agents. “Manager Assigned” >> click on magnifying glass for the list >> select the manager from the list >> “Save”.
Now, we have a scenario in which the Managers list for only desired managers will be available to select.
Manager Object Edit >> Search Layouts >> Lookup Dialogs >> Edit >> Manager Lookup Dialogs >> Available Fields >> Select Desired Field (Manager Field) bring it to right .
Based on our requirement, we show the “Manager” accordingly by editing the particular field.
Steps: “Agents Object Edit” >> Lookup Filter >> Show Filter Settings >> Filter Criteria >> Select Field, Operator, Value/Field >> Filter Type >> Required / Optional >> Enable the filter >> Save.
Now, click the “New” button in the “Agent Object” to add new records, and you can look at the changes made for only desired manager filter.
From the above figure, we can select “Sales Manual” >> Save. But, we can even select other manager types also by typing in the field.
Steps: Agent >> New >> Manager Assigned >> Type Required Manager Name(eg: Kaushik ) >> Save
By the above scenario, we can also select the managers not on the list as well.
Problems with Lookup Relationship
- No strong binding.
- If we add New Agent >> and do not select manager, we can save it.
- If the Manager record is deleted, there is no impact on the agent record.
With the lookup relationship, the connection/bonding between two objects is not possible.
In the next topics, we will discuss in detail about “MDR - Master-Detail Relationship”. Keep following us for more info on Salesforce Administration
Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts