Objectrelationship-scaled-1-2048x665
Salesforce

Object Relationship in Salesforce

Data has always been the utmost important aspect of handling CRM activities in a business organization. Depending on its scale of operations, an active business house deals with hundreds and thousands of customers on a day-to-day basis. This implies that the employees have to process huge volumes of data on a daily basis.

Salesforce has been highly effective in lifting this load off the shoulders of several enterprises. It allows automated and efficient handling of the complicated customer database, allowing the sales representatives to make the most of the business data and provide personalized services to the clients/customers.

With highly customizable offerings such as Salesforce Marketing Cloud, Salesforce Service Cloud, Salesforce Sales Cloud, and many more, the CRM platform ensures that your valuable data is processed in the best way possible. However, it is extremely important for this data to be represented in a way that it is easily understandable by the users. Through efficient data modeling, Salesforce helps you store information in distinct Salesforce objects.

What Is A Salesforce Object?

A Salesforce object is essentially a database table that stores all relevant information and business data Salesforce helps you deal with. These tables are dedicated to specific information pertaining to the organisation, especially regarding the customers catered by the firm. While a Salesforce object is a table, its columns are referred to as fields and rows are referred to as records.

There are two types of Salesforce objects – Standard Objects and Custom Objects. Standard Objects are the objects created by Salesforce that are already present within the platform when it is implemented. Leads, Opportunities, Cases, Accounts and Contacts are examples of Standard Objects. One the other hand, Custom Objects are the objects that are created by the users if the Standard Objects do not meet the specific business requirements.

Relationships Between Salesforce Objects

An object relationship in Salesforce is a relationship between two Salesforce objects. When you link an object with another, you can view the related data present in the records pertaining to the connected objects. Salesforce relationships are established to allow users to perform specific actions on the CRM platforms.

Depending on your requirement, you can define different Salesforce relationships by creating custom relationship fields on a Salesforce object. Users often establish object relationships to display relevant data about relating Salesforce objects and their records on the detail page of a specific record. Generally, these relationships are created to ascertain specific values and avoid the repetition of data within the system.

There are four major types of object relationships in Salesforce – Lookup Relationship, Hierarchical Relationship, Master-detail Relationship, and Many-to-many Relationship.

Lookup Relationship

This object relationship in Salesforce allows users to link two Salesforce objects together in a way that one object can access the fields of the other. Here, the objects are connected without having an effect on their security and deletion properties.

Such a relationship is often added to standard, custom, and external Salesforce objects to create intermediary relations between them. Lookup relationships can be of two major types – one-to-one or one-to-many. Here, the objects may or may not be related to each other.

This relationship can be created by connecting a child object to a parent object. While it can be added to the standard, custom, and external objects to act as child records, only standard and custom objects can serve as parent records. Every child record in such a relationship bears a lookup icon that displays the parent record when clicked and vice versa.

As opposed to other relationships, Lookup relationships are not required automatically. Users have a choice to access the linked objects on an individual or joint basis. This implies that if one object gets deleted, the other one would remain intact within the system.

Here are the major steps involves in creating an external Lookup relationship:

1. Start by navigating to the Setup.

2. Select the option of “Develop”, followed by “External Objects”.

3. Click on an object to want to connect, for instance “OrderDetails”.

4. Now, locate the field of the second object, for instance, “OrderID”. Click on the “Edit” button and choose “Change Field Type”.

5. Select the option of “External Lookup Relationship” as the data type.

6. After clicking on “Next”, select “Orders” under the option of Related to value.

7. Type the required number, say 18, under the option of field length. Keep the other options intact according to their default values.

8. Click on “Next”. If you want the field to be visible to all the profiles, click on the checkbox beside “Visible”.

9. Click on “Next”. Make sure you do not edit the checkboxes that will now appear. Let them retain their default values.

10. Click on “Save” to complete the processes.

Hierarchical Relationship

This is one of the relationships in Salesforce that allows you to use a lookup field for associating one User with another that does not refer to itself. It is a special type of Lookup relationship that is available only for the User object.

An instance in which such a relationship can be established is creating a custom hierarchical field for storing the direct manager for every user within your organization. The hierarchical relationship is essentially a one-to-one relationship. This implies that it can only be established with one user object in the approval process.

Master-detail Relationship

This is the object relationship in Salesforce similar to the Lookup relationship, the only difference being the fact that the parent and child records are always strongly connected to each other. The parent object is called “master” while the child object is called “detail”.

In such a relationship, the child’s record will get deleted if its parent record is deleted. The child record cannot exist independently and is always associated with its parent record. Moreover, only custom objects and not standard objects can be used as child objects.

Here are the major steps involved in creating a Master-detail relationship between the objects of Candidates (master) and Jobs Applied (detail):

 Go to Setup, followed by clicking on “Objects” in the Create option of App Setup.

 Select the option of “Jobs Applied”.

 Go to “Custom Fields and Relationships.

 Select “New” followed by “Master-detail Relationship.”

 Now, relate the object to the Candidates object.

 Add the field label and field name.

 You will obtain the child’s relationship name.

 Click on “Save” to complete the processes.

After creating this relationship, you can also create a roll-up summary for any field pertaining to the master object controls.

Many-to-many Relationship

This is the relationship that cannot be directly created but comes into being when two master objects have a common child object. This common child object is called a Function object and the relationship between the master objects is called a Many-to-many relationship.

A major contributor to creating such a relationship is the Junction object. Salesforce Junction object is a custom object having two Master-detail relationships to two distinct record types. Junction objects are used to represent Many-to-many relationships as multiple Junction objects tend to connect one record instance to several children records, with each child record being equally linked.

Every Many-to-many relationship in Salesforce starts with the creation of a Junction object.