A junction object is a Salesforce object that contains many-to-many relationships between two related objects.
What is a Junction Object in Salesforce?
If you want to create the many-to-many relation then we need to use the Junction object in Salesforce. A junction Object is a type of custom object which allows linking two custom objects.
A junction Object in simple terms can be called a custom object with two master details fields
Junction Object Examples
For example, Let us assume that we have two Objects – Contact and Room. To provide the many-to-many relationship between the Contact and the Room, we will need to create one more object let’s say it would be Reservation, it will be called a junction object.
Relationship Types in Salesforce
Let’s see how many types of relationship type in Salesforce.
- Master-Detail Relationship: One Object is considered as the Master and the other as the Detail. If you delete the record of the Master Object, the information of the Detail Object will get deleted automatically.
- Look-Up Relationship: The Objects in a Look-Up Relationship are connected loosely. It means that if you delete the record of an Object, it will not impact the linked Object.
- Many-to-Many Relationship: Records of a particular object can connect with various records of different objects and vice versa.
- Self Relationship: It means an Object is creating a relationship with itself.
- External Relationship: This field is used to connect the external Object with another external object.
Steps to create a Junction Object in Salesforce
Check the below session from min 46:00 to learn about junction objects.
Junction Object Interview Question
Try below and find the answer to the Junction Object Interview Question. Don’t forget to share the answers in comment
- As a user, you will able to see junction records in Salesforce when you don’t have read access on one parent record.
- What happened to the junction record when someone deleted the one-parent record?