Object Relationships Overview – SalesForce - MindMajix
Maybe your like
In Salesforce, the Data relationship between objects is quite a tricky topic. In this article, we would be discussing the types of relationships in Salesforce and which relationship should be used when extending your Salesforce data model.
Relationships in SalesForce
A relationship is a two-way association between two objects. Relationships associate objects with other objects. Create relationships to link objects with each other, so that when your users view records, they can also see related data. You can define different types of relationships by creating custom relationship fields on an object.
Even without relationships, we could build out as many custom objects as we wish, but they’d have no way of linking to one another. With relationships, we can make such a connection and we can also display data about other related objects & records on a particular record’s detail page.
Relationship: dependency of values
Why we need it?
To derive values and to eliminate repetition and inconsistency
Introducing Relationship Custom Fields:
We can define a relationship between two objects through the use of common fields on the platform; we can define relationships between objects by creating a relationship custom field that associates one object with another.A relationship field is a custom field on an object record that contains a link to another record. When we place a relationship custom field on an object, we are effectively creating a many-to-one relationship between the object on which the relationship field is placed. Fortunately for us, many-to-many relationships allow for greater flexibility.There are different types of relationship fields, each with different implication, those four types are:1. Hierarchical relationship → 1:12. Look-up relationship → 1:M3. Master-details relationship → 1:M4. Many-to-many relationship → M:M
| Want to enhance your skills in dealing with the world's best CRM, enroll in our Salesforce Online Course |
Hierarchical Relationship:
This type of relationship is a special lookup relationship available only for the user object. It allows users to use a lookup field to associate one user with another that does not directly or indirectly refer to itself. For example, you can create a custom hierarchical relationship field to store each user’s direct manager.It is a one-to-one relationship, it can be created only with one user object in the approval process so as to assign who is reporting to whom.![]()
Lookup Relationship:
-
One to Many relationships links one record to another record.
-
Can link standard to custom objects and vice versa, or link to the same object type (parent account, for instance).
The field of objects gets its values from the record of objects, if the record in object1 gets deleted the field becomes empty in objects2.
![]()
In a 1-to-many relationship, if we delete the parent record, the child record will not get deleted
Creating look-up relationship:

Master-Detail Relationship:
It is similar to a look-up relationship, but if a parent record is deleted, the child record also will be deleted automatically.
-
Every child record should be associated to a parent, child record can’t exist individually.
-
Manual sharing and sharing rules are not allowed for the child record.
-
We can’t have standard objects on the child side, only custom objects are allowed.
Creating master-details relationship:
This is a parent-child relationship where master-objects control certain behaviors of the detail-object.Software candidates and jobs applied objectsClick on username → setup → app setup → create → objects → click on jobs applied object → go to custom fields and relationship click on new → master details relationship (select) → next → related to the candidate → next → field label candidate → field name candidate → child relationship name jobs-applied1 → next → next → save.Now, that the master-detail relationship for the candidate object is created, the candidate object acts as a master object now. We can create a roll-up summary for any field in candidate master objects.
Rollup summary:
A roll-up summary field calculates values from related records, such as those in a related list. You can create a roll-up summary field to display a value in a master record based on the values of fields in a detail record. The detailed record must be related to the master through a master-detail relationship.The read-only field is used to display the count of the child records as sum, count, min, max of a field in the particular child object.This will only enable the master-detail relationship for the master.
How to activate the roll-up summary?
- There are no steps to activate.
- The rollup summary field gets activated automatically when an object becomes a master object.
- A look-up relationship does not activate rollup summary
- A rollup summary field providers aggregate in the form of a child object field in the master objects.
Creating rollup summary:
Begin creating your roll-up summary just as you create any other custom field:
Master object candidateSummarized object jobs appliedSelect roll-up type1. Count2. Sum3. Min field to aggregate none4. Max ↓ Next → save.Sum, min, max are only done on currency, number, dates
| Related Article: Salesforce Interview Questions & Answers |
The difference between save and quicksave→ Save: Save completes the save process and closes the Page Layout Edit window. After saving, it will take you back to the objects page→ Quicksave: Quick Save allows you to save your changes, but keeps you on the Page Layout Edit screen. Then in another tab, you can refresh the view and see your changes will take place. After saving, it will stay on the list page.
Many – Many Relationship:
This relationship cannot be created directly, it comes as a result of two master objects having a common child object.The child objects are known as function objects and the relationship between the two master objects is known as many-many relationships.Ex: A single position can be found on multiple websites and on one website we have multiple positions.
Junction Object: In Salesforce, a Junction Object is a custom object with two master-detail relationships to two different record types. It is used to represent a many-to-many relationship in which several junction objects can link one instance of a record to many children, and each child can equally be linked to.
| Related Article: Learn Salesforce Tutorials |
Creating Many-to-Many Relationships:
First, create junction objectSetup → create → object → new custom object → student tech → data type auto number → display format ju-{000} → starting no1 → saveCreate MDR between student techs to student (master)Related list label student ↓ Save and newCreate MDR between student techs to technology (master)Related list label technology ↓ Save
Formula Relationship
One field computes its values from another field of the objecte.g.: age, simple interest and return on investmentDOB 10-10-2000Age 10-10-2000 → formula field
Formula:
Formula is a read-only field which is used to derive a value based on expressions.e.g.: city &“,”& company ↓Hyd, TCS
- The formula operators will be changing based on the value return type.
For e.g.: the return type is numeric, the available operator is +,-,x,%If return type character ”&” is the only operator ‘&’ and is used to concatenate stringsFrom the custom field ↓ Go ↓
Choose a data type formula→ Returned value type
- Numeric
- Percentage
→ CharacterField labelField tab name
- Text
Text=city &“”& company → next → next → save→ HydTcs
Formula return type:
A formula result can be of only 6 data types1. Currency2. Date3. Date time4. Text5. Number6. Percent
Conclusion
We have come to the end of this guide. We hope that you have clearly understood the types of object relationships in Salesforce. Still, if you have any queries, please feel free to drop your question in the comment section. We will resolve it as soon as possible.
Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts
| Salesforce Administration Training | Salesforce Lightning Training |
| Salesforce Advanced Developer Training | Salesforce Developer Training |
| Salesforce IoT Training | Salesforce App Builder Certification Training |
| Salesforce AppExchange Training | Salesforce Service Cloud Training |
| and many more.. |
Tag » How To Relate The Fields Of Two Objects In Salesforce
-
Create Object Relationships Unit - Trailhead - Salesforce
-
Object Relationships Overview - Salesforce Help
-
Create A Many-to-Many Relationship - Salesforce Help
-
Salesforce Object Relationships - Workato Docs
-
How Do You Relate Two Custom Objects In Salesforce? - Quora
-
Creating Look-Up Relationship Between Two Fields In Salesforce ...
-
How Do Objects Relate To Each Other In Salesforce - YouTube
-
The 6 Types Of Relationships In Salesforce
-
Salesforce Junction Objects - Marketing Logic
-
How To Share Notes Between Two Objects - Salesforce Stack Exchange
-
How To Create Master-detail Relationship In Salesforce? - MicroPyramid
-
Can You Make A Report Type With Two Objects That Lookup To The Same ...
-
How Can I Relate Activity To A Second Object In Salesforce?
-
Types Of Objects And Fields In Salesforce - Packt Subscription