Junction Object And Self-Lookup in Salesforce

Junction Object

Hope you guys enjoyed my last article and got a good idea about lookup and master-detail relationship. Now we are going to discuss junction object and self-lookup. Both play a huge role in the project. Junction object works as a mediator between two objects. We can see the junction object easily in our real life.

Example:-

Metro junction:- Usually, everyone travels in metro trains. So, we know that many passengers take the same metro at the same time. However, everyone is not going to the same place. So, people change the metro accordingly on stations and those stations work like a junction between origin and destination.

In the above image, you can see that there are multiple stations which act as a junction. Similarly in programming language junction object provides the access of other object data respectively. Now come to the programming world. We have two objects; the first object is a student and the second object is a book; and one more object library(junction Object). So, the library object takes care of which student has which books.

The image displays the structure of relationships. Below image will make your concept more clear. You are going to see real junction object records.

Relation UI on schema builder. You can check all relation of object here Quick Find >> Search “Schema Builder”>> Select the object.


Records of book object:-
Records of Student object:-Records of Library(junction) object:-

Now, you can say Jone have an English book. I hope now you are clear about the junction object.

Self-Lookup

Did you know that we can relate our object by itself called self-lookup in Salesforce? It’s okay if you don’t, and do you know what is the need for self-relationship? So, today we are going through a real-world example to understand the need for self-lookup.Suppose you order some product from an online store, but you have not got the right product at the moment of delivery. So, you raise the case to replace the product;and the second time you get the right product but the product is not worth of money, or you are not comfortable with that product. So, you raise the case for a refund. Your first case becomes a master case or parent case and second becomes a child.

You can see the standard self lookup on account object. There is a Parent Account lookup field on the account detail page.Hope you understand the need for self-lookup and clear about self lookup.

Please click on the like button below and subscribe to our blog with signup with you get the latest update.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to MailChimp ( more information )
50% LikesVS
50% Dislikes