Skip to main content
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

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

Using a custom junction object, you can model a “many-to-many” relationship between two objects. For example, you may have a custom object called “Bug” that relates to the standard case object such that a bug could be related to multiple cases and a case could also be related to multiple bugs.

To create a junction object, you need to make a new custom object type and add to it two master-detail lookup fields to the two parent/child objects that are being mapped. When you then want to link a parent to it's many children (or visa versa) you need to then create these records. This can be done programmatically, or using any of the many dataloading tools.

As of Spring '14 junction object still consume the 2Kb of record data a normal custom object record takes up, so developers must be mindful of creating too many of them to represent the often verbose many-to-many relationships they are intended for. There is an ideas post here to facilitate a lightweight option and you can read the full documentation on using and creating Junction objects on developerforce docs.