3

I have a custom object called Sports that ties to contact (student) information. The Sports object is used for coaches to review the qualifications of a prospective athlete (student). Since a student could be interested in more than one sport, they could have more than one Sports object. My question is - is it possible to have a related list on the Sports screen that would contain a related list to the additional sports objects?

4

What you are talking about is a "many-to-many" relationship. Each student can do multiple sports, and each sport can be done by multiple students.

The most natural way to implement this in Salesforce is through a junction object.

http://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm&language=en_US

This will allow you to see the related lists and also supports reporting.

edit--- In the simplest example, your record would look something like this enter image description here

The student has a list of as many sports as required, each student can re-use the same sports. The process of adding looks like this when you click on "new student sport" enter image description here

and from the other side of the relationship, when you look at any given Sport you will see the students who are linked through the junction object, like this enter image description here

  • another question - since this is a new object, how do you populate it with the information? Through a workflow or trigger? – user2569499 Dec 4 '13 at 15:18
  • I've edited the answer to show how it would look. Through the UI it would be most natural to populate using the "new" button on the related list. You could also build a custom VF page if you wanted to, say, be a bit more fancy about grouping and presenting sports and adding multiple at the same time. – Doug B Dec 4 '13 at 15:30
  • Here is my problem. I created the junction object, which basically ties the Sports object and the Contact object (which is indicated by your screen shots). The process flow would be that the contact would be created and then through the linked list to Sports, the Sports object would be created - but I don't want to have to manually create the junction object. I want it to just be there. – user2569499 Dec 4 '13 at 15:59
  • So, the Tennis which contact A plays is the same as the Tennis which contact B plays. There should be only one Tennis record. Then when you insert a Contact, and you want to insert the list of sports they play, you insert junction object records, one per sport played. You only need to insert a new Sport record when a genuinely new Sport is added, such as someone takes up Cricket for the first time. – Doug B Dec 4 '13 at 16:13
  • That is not the way it works in my set up. The Tennis (sports object) that contact A has is not the same as the Tennis (sports object) that contact B has. My goal is to show all of the sports objects when I am on one sports object. I can see how that would work with a junction object, but I'm missing the piece where the junction object is built from creating the sports object. – user2569499 Dec 4 '13 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.