Question

Difficulty: MediumObject Relationships (Lookup, Master-Detail, Many-to-Many)

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)

  1. Create a custom junction object with Master-Detail relationships to both the Course and Student objects.Answer
  2. Create a Roll-Up Summary field on the Course object that calculates the count of related enrollment records.Answer
  3. C
    Create a Roll-Up Summary field directly on the Course object using a Lookup relationship to the Student object.
  4. D
    Create 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

1
Analyze relationship cardinality and deletion requirements.
A many-to-many relationship requires a custom junction object with Master-Detail relationships to enable cascade-deletion when a master record is removed.
Master-Detail relationships enforce cascading deletion of detail records when the master record is deleted.
2
Evaluate field capabilities for calculating total enrollments.
Roll-Up Summary fields are created on the master object to aggregate child records in a Master-Detail relationship.
Lookup relationships do not support native Roll-Up Summary fields without custom automation or Apex.

Key Concept

Many-to-Many Relationships and Roll-Up Summary Field Requirements
Rate this question