An administrator is designing a custom data model for tracking Project__c records and Team_Member__c records using a junction object named Project_Assignment__c. The business requirement specifies that the total allocated hours from all Project_Assignment__c records must be aggregated directly on the Project__c record using standard declarative functionality without Apex code. Additionally, if a Team_Member__c record is deleted, any existing historical Project_Assignment__c records must remain in the system with their link to the deleted Team_Member__c cleared. Which relationship configuration on Project_Assignment__c fulfills these requirements?
- Define a Master-Detail relationship pointing to Project__c and a Lookup relationship pointing to Team_Member__c configured to clear the value of the field if the record is deleted.Answer
- BDefine a Lookup relationship pointing to Project__c and a Lookup relationship pointing to Team_Member__c, then create a Roll-Up Summary field on Project__c to sum the hours.
- CDefine a Master-Detail relationship pointing to Project__c and a Master-Detail relationship pointing to Team_Member__c, enabling the option to disallow deletion on the Team_Member__c relationship.
- DDefine a Many-to-Many indirect Lookup relationship on Project__c and configure a formula field on Project__c to calculate the sum of allocated hours.
Answer
The administrator should configure a Master-Detail relationship on Project_Assignment__c pointing to Project__c, and a Lookup relationship on Project_Assignment__c pointing to Team_Member__c set to clear the field value upon deletion.
To create a declarative Roll-Up Summary field on Project__c, Project_Assignment__c must have a Master-Detail relationship pointing to Project__c. To prevent Project_Assignment__c records from being deleted when a Team_Member__c record is deleted, the relationship to Team_Member__c must be a Lookup relationship configured with the delete option to clear the value of the field.
Step-by-Step Solution
Key Concept
Master-Detail vs. Lookup Relationship Capabilities and Deletion Behavior