Object Relationships Overview – SalesForce

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:1
  2. Look-up relationship → 1:M
  3. Master-details relationship → 1:M
  4. Many-to-many relationship → M:M


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.



  • One to Many relationship 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 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:



It is similar to 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 objects

Click 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 candidate object is created, the candidate object acts as 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 detail 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 master-detail relationship for the master.

How to activate 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 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 candidate

Summarized object jobs applied

Select roll up type

o   Count

o   Sum

o   Min field to aggregate none

o   Max                          ↓

                                Next → save.

Sum, min, max are only done on currency, number, dates


The difference between save and quick save

→ Save: Save completes the save process and closes the Page Layout Edit window. After saving, it will take you back to objects page

→ Quick save: 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.


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 relationship.

Ex: A single position can be found on multiple website and on one website we have multiple positions.


Junction Object: In Salesforce, a Junction Object is a custom object with two masters-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. 

Creating Many-to-Many Relationship:

First, create junction object

Setup → create → object → new custom object → student tech → data type auto number → display format ju-{000} → starting no1 → save

Create MDR between student techs to student (master)

Related list label student


       Save and new

Create MDR between student techs to technology (master)

Related list label technology




One field computes its values from another field of the object

e.g.: age, simple interest and return on investment

DOB 10-10-2000

Age 10-10-2000 → formula field


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 are +,-,x,%

If return type character ”&” is the only operator ‘&’ and is used to concatenate strings

From the custom field




Choose a data type formula

→ Returned value type

  • Numeric
  • Percentage

→ Character

Field label

Field tab name

  • Text

 Text=city &“”& company → next → next → save

→ HydTcs

Formula return type:

A formula result can be of only 6 data types

  1. Currency
  2. Date
  3. Date time
  4. Text
  5. Number
  6. Percent

Enroll for Instructor Led Live Online SalesForce Training


0 Responses on Object Relationships Overview – SalesForce"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.