Soru

Zorluk: OrtaObject Relationships (Lookup, Master-Detail, Many-to-Many)

A Salesforce Administrator needs to update an existing data model. Currently, a custom object named `Project_Task__c` references a custom object named `Project_Plan__c` using a Lookup relationship. The business requirements state that deleting a `Project_Plan__c` record must automatically delete all associated `Project_Task__c` records. In addition, the administrator must display the total estimated hours from all related tasks on the `Project_Plan__c` record using a standard Roll-Up Summary field. Which sequence of actions should the administrator perform to fulfill these requirements?

  1. Verify that all `Project_Task__c` records have a populated `Project_Plan__c` field, convert the Lookup relationship to a Master-Detail relationship on `Project_Task__c`, and then create a Roll-Up Summary field on `Project_Plan__c`.Cevap
  2. B
    Keep the existing Lookup relationship on `Project_Task__c`, enable cascade delete on the lookup definition, and create a Roll-Up Summary field directly on `Project_Plan__c`.
  3. C
    Create a new Master-Detail relationship field on `Project_Plan__c` that references `Project_Task__c` as the detail object, and then add a Roll-Up Summary field on `Project_Task__c`.
  4. D
    Change the Organization-Wide Default (OWD) sharing setting of `Project_Task__c` to Controlled by Parent and add a custom Formula field on `Project_Plan__c` to sum the hours.

Cevap

Verify that all existing child records contain a value in the lookup field, convert the Lookup relationship on the child object to a Master-Detail relationship, and create the Roll-Up Summary field on the parent object.
To calculate aggregate values via native Roll-Up Summary fields and ensure automatic deletion of child records when a parent is deleted, a Master-Detail relationship is required. Before converting an existing Lookup relationship field to Master-Detail, every child record (`Project_Task__c`) must have a value in that lookup field. Once converted, Roll-Up Summary fields can be created on the master object (`Project_Plan__c`).

Adım Adım Çözüm

1
Ensure data completeness on the detail object
Every `Project_Task__c` record has a non-null value in the `Project_Plan__c` lookup field.
Salesforce requires all child records to have a parent reference before converting a Lookup relationship to a Master-Detail relationship.
2
Change field type from Lookup to Master-Detail
The relationship is updated to Master-Detail, automatically establishing cascade deletion behavior.
Master-Detail relationships natively enforce cascade deletion of detail records when a master record is deleted.
3
Create Roll-Up Summary field on `Project_Plan__c`
The total estimated hours are aggregated automatically on the master record.
Roll-Up Summary fields require a Master-Detail relationship to calculate aggregate values from detail records.

Anahtar Kavram

Lookup to Master-Detail Relationship Conversion & Roll-Up Summary Prerequisites
Bu soruyu puanla