Business Scenario: You want to be able to track many assets to many cases, and vice versa. The scenario could apply to any two objects, but I find that cases typically works the best to illustrate this point. You may have many cases that reference a specific Asset or other type of Object owned by a customer. Alternatively you may have a single case that is referencing many of the Customer’s objects at once. A simple master detail relationship cannot work since it’s a one-to-many, same goes for a Lookup relationship.
Solution: A Junction Object in SalesForce is an object you create in between two objects that you use to track the many to many relationships between them.
Benefit: Junction objects allow you to track multiple records at once in either direction. For example, say you have a customer service role that deals with consumer electronics issues. You could have a single case that references a consumer’s TV, remote, and Blue Ray player as the items in question all in one case very easily. The big advantage is that you can pick and choose specific items to reference. What if that consumer also owned a second TV and a computer that were also purchased from your company?
Below is an example of how to create a Junction Object between the standard object Case and a custom object called Equipment.
1. Create a new custom object called “Troubled Equipment”
2. Give the Troubled Equipment object 2 master-detail relationships, one from Case to Equipment, and one from Equipment to Case
3. On the Case Page Layout, add a related list for “Troubled Equipment”, and on the Equipment Page Layout, add the related list and call it “Cases”
4. Optionally, you could add filter criteria that would allow you only to choose Equipment owned by that customer. To do this you will need to either create a custom URL that automatically fills in the Customer name when adding new Equipment, or create a VisulForce page to override the standard “Add New” page that is created.
I hope you find this information helpful. 🙂