A Junction is an object which is used to combine two master-detail relationships. In a layman’s language, when two relationships came together injunction, they form one relationship out of the two.
Case 1: One to Many Relationships
Case 2: Many to One Relationship
Result: Many to Many Relationships
We have taken an easy example of a recruitment application which will clarify the meaning and usage of Junction object.
Case 1: There can be only one Position available for a particular job profile. But for that particular job profile, there can be multiple candidates. This is the case of One to Many relationships. That is one job and many candidates. Case 2: There can be only one candidate but is eligible for many job profiles. This is the case of Many to One relationship. That is one candidate and many job profiles. Result: To make both of the two cases compatible with each other, we need to create another 3rd case (Salesforce Lookup field) for both the cases that is, job position and candidate. As a result, it will return a kind of filter option using which compatibility of both cases will be found. We will be able to look either for the applicant who is compatible with different job profiles, or the job profile for which multiple candidates are eligible. This is the case of Many to Many relationships.
In Salesforce, there are objects called “Junction.” The Junction objects are used in Salesforce to build relationships in multiple capabilities between the things in Salesforce. When there is a requirement to link several different things with one thing or one object, therefore, there can be many applicants for particular applications. Many examples are relatable to Salesforce Junction object. Like- Car dealership: many vehicles and many Customers, Pharmaceuticals: many medicines and many patients, many educational programs and many students, and much more. There are two fields to achieve Salesforce Junction object. They are both one to many relationships; and they are both defined from many to one side that is, from a child to a parent. They can be made one to one relationship by adjoining validation rules or may trigger to enforce one to one nature; that is, only one child is allowed. Detail of the two fields of Salesforce – Master-detail, and Lookup are given below: -
In M: M relationship, one record o one object is linked to multiple records of another object and vice versa. In Salesforce, there is no pre-availability of Many to Many relationships, but we create them; which is done by creating two master-details relationship with a Junction Object which is common.
It is the most common question which is asked in the interview with Salesforce applicants. It is a custom object which is used to link one exemplar of a record to many child records and many child records to on records equally. Examples are already mentioned above. Now, we will learn step by step procedure to create a Junction object for Many to Many relationships in Salesforce. To create Many to Many relationships, initially, we have to create a Junction object.
Let us assume we want to relate A and B, and have to create one more object C. C will be the Junction object. Let us start with creating a Custom Junction Object. Initially, we will create an object A. Now, we have to create two more objects B and C in the same way as object A is created. Now, we are going to use Object C as a junction object for A and B. Create “First Master-detail” field on the object and select object A as a parent. This will act as the Primary master-detailed relationship. In the next view, you have to assign a name to the field. For the Master record A, we have assigned the name “ChildOfA” and in the same manner, for B we have assigned the name “ChildOfB”. So, until now, we have created two objects- Object A and Object B. Now we can create a tab for all the custom objects to add the new record. Firstly, create the record A and B and for record C, follow the screenshot below:- Things to Remember:-
Modify the Page Layouts
Next step is to add fields on the Positions Page layout.
Now, add fields to the position related list on the site page layout
Now, testing for all what you have done
Object helps in the creation of Many to Many relationships which may consist of:-
The order of master objects in the report type is important. Other than that, the master object which listed object first determines the scope of records that are displayed in the report. Based on this, you can create custom reports based on these standard based reports. You can also create custom type report to customize which is related to the objects that are joined in the report. Summing up, Salesforce is not just a game player but the game-changing CRM platform. So ride the wave of Salesforce and explore wider features. If you want to know more about Salesforce, you should take Salesforce training and play around with records that are made specifically for that purpose only.
JanBask Training is a leading Global Online Training Provider through Live Sessions. The Live classes provide a blended approach of hands on experience along with theoretical knowledge which is driven by certified professionals.
Receive Latest Materials and Offers on Salesforce Course