A Salesforce Administrator is designing a custom data model for a university to connect Students (`Student__c`) and Courses (`Course__c`). A student can enroll in multiple courses, and a course can have multiple students. The business requirements state that the total number of enrolled students must be dynamically calculated on each course record, and deleting a student must automatically remove their specific enrollment records. Which two configuration steps should the administrator take to meet these requirements? (Select 2 answers)
- Create a custom junction object with Master-Detail relationships to both the Course and Student objects.Answer
- Create a Roll-Up Summary field on the Course object that calculates the count of related enrollment records.Answer
- CCreate a Roll-Up Summary field directly on the Course object using a Lookup relationship to the Student object.
- DCreate Lookup relationships from a junction object to both Course and Student so enrollment records persist when a student is deleted.
Answer
To implement a many-to-many relationship with automated deletion cascading and aggregate metrics, the administrator must create a custom junction object with Master-Detail relationships to both Course and Student, and create a Roll-Up Summary field on the Course object to calculate total enrollment records.
Establishing a junction object with Master-Detail relationships to both master objects creates a robust many-to-many structure. Master-Detail relationships allow the parent object to use Roll-Up Summary fields to count child records and ensure that deleting a primary record automatically cascade-deletes the associated junction records.
Step-by-Step Solution
Key Concept
Many-to-Many Relationships and Roll-Up Summary Field Requirements