Soru

Zorluk: Çok zorObject Relationships (Lookup, Master-Detail, Many-to-Many)

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?

  1. 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.Cevap
  2. B
    Define 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.
  3. C
    Define 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.
  4. D
    Define 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.

Cevap

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.

Adım Adım Çözüm

1
Analyze the aggregation requirement for Project__c.
Aggregating values declaratively across child records requires a Roll-Up Summary field on Project__c.
Roll-Up Summary fields are supported exclusively on the parent object of a Master-Detail relationship.
2
Analyze the deletion requirement for Team_Member__c.
Deleting a Team_Member__c record must preserve Project_Assignment__c records.
Master-Detail relationships trigger cascading deletes, whereas Lookup relationships allow clearing the lookup field value when the referenced record is deleted.
3
Combine relationship requirements into the object schema.
Project_Assignment__c requires a Master-Detail field referencing Project__c and a Lookup field referencing Team_Member__c.
This hybrid structure allows Project__c to perform roll-up calculations while protecting Project_Assignment__c from cascade deletion when Team_Member__c is deleted.

Anahtar Kavram

Master-Detail vs. Lookup Relationship Capabilities and Deletion Behavior
Bu soruyu puanla