Soru

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

A healthcare company uses Salesforce to manage patient care. The administrator is designing a custom data model to link a custom object named Medical_Procedure__c to both Patient__c and Doctor__c. The architecture must satisfy two specific constraints:
1. The Patient__c record must display a native Roll-Up Summary field calculating the sum of procedure costs from all related Medical_Procedure__c records.
2. If a Doctor__c record is deleted from the system, any associated Medical_Procedure__c records must remain active, and the reference to the deleted doctor must simply be cleared.

Which relationship configuration must the administrator implement on the Medical_Procedure__c object to meet these requirements?

  1. Create a Master-Detail relationship pointing to Patient__c, and create a Lookup relationship pointing to Doctor__c configured to clear the value of the field if deleted.Cevap
  2. B
    Create Master-Detail relationships pointing to both Patient__c and Doctor__c, enabling the 'Allow reparenting' option on the Doctor__c relationship.
  3. C
    Create Lookup relationships pointing to both Patient__c and Doctor__c, setting the Organization-Wide Defaults of Medical_Procedure__c to Controlled by Parent.
  4. D
    Create a Master-Detail relationship pointing to Doctor__c, and create a Lookup relationship pointing to Patient__c.

Cevap

Create a Master-Detail relationship from Medical_Procedure__c to Patient__c, and a Lookup relationship from Medical_Procedure__c to Doctor__c configured to clear the field value upon record deletion.
To calculate roll-up summary values natively on Patient__c, Patient__c must be the master object in a Master-Detail relationship with Medical_Procedure__c. To prevent Medical_Procedure__c records from being deleted when a Doctor__c record is removed, the link to Doctor__c must be a Lookup relationship set to clear the field value upon deletion.

Adım Adım Çözüm

1
Analyze the Roll-Up Summary requirement on Patient__c
Native Roll-Up Summary fields are strictly supported on the master side of a Master-Detail relationship. Therefore, Medical_Procedure__c must be the detail object in a Master-Detail relationship with Patient__c.
Lookup relationships do not support native declarative Roll-Up Summary fields.
2
Analyze the deletion requirement for Doctor__c
Medical_Procedure__c must have a Lookup relationship to Doctor__c configured with the 'Clear the value of this field' deletion option.
If Doctor__c were established as a Master in a Master-Detail relationship, deleting a Doctor__c record would trigger a cascade deletion of all related Medical_Procedure__c records, violating the requirement.
3
Combine relationship definitions on the custom object
Medical_Procedure__c functions as a hybrid junction object (Master-Detail to Patient__c and Lookup to Doctor__c), satisfying both calculation and record persistence requirements.
Custom objects support up to two Master-Detail relationships alongside multiple Lookup relationships.

Anahtar Kavram

Object Relationship Design (Master-Detail vs. Lookup Behavior)
Tahmini Süre:2m 0s
Bu soruyu puanla