Question

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

A Salesforce Administrator is designing a custom data model for an IT department to link Workstations (`Workstation__c`) and Software Applications (`Software_App__c`). A workstation can host multiple software applications, and a software application can be installed on multiple workstations. The business requires calculating the total licensing cost of all installed applications directly on each Workstation record. Additionally, deleting a Workstation record must automatically remove its installation association records without deleting the Software Application records. Which configuration satisfies these requirements?

  1. Create a custom junction object with two Master-Detail relationship fields referencing Workstation and Software Application, then create a Roll-Up Summary field on the Workstation object.Answer
  2. B
    Create a custom junction object with two Lookup relationship fields referencing Workstation and Software Application, then create a Roll-Up Summary field on the Workstation object.
  3. C
    Create a single Master-Detail relationship field on the Software Application object pointing to Workstation to aggregate licensing costs.
  4. D
    Create a custom junction object with two Lookup relationship fields and configure custom apex triggers to simulate cascading deletes and summaries.

Answer

Create a custom junction object with two Master-Detail relationship fields referencing Workstation and Software Application, then create a Roll-Up Summary field on the Workstation object.
To model a many-to-many relationship while supporting declarative Roll-Up Summary fields and cascading deletion of junction records, a custom junction object with two Master-Detail relationships is required. Creating a Master-Detail field to Workstation allows native Roll-Up Summary fields on Workstation, and deleting a Workstation record will delete only the junction records associated with it while leaving the Software Application master records intact.

Step-by-Step Solution

1
Analyze relationship requirements
Since one workstation can host multiple applications and one application can be installed on multiple workstations, a Many-to-Many relationship using a custom junction object is required.
Salesforce implements many-to-many relationships by placing a junction object between two parent objects.
2
Determine relationship types on the junction object
Use Master-Detail relationship fields pointing to Workstation and Software Application.
Master-Detail relationships allow native Roll-Up Summary fields on the master object and automatically cascade record deletion to junction records without deleting the opposite master object.
3
Configure data aggregation
Create a Roll-Up Summary field on the Workstation object to sum licensing costs from the junction object records.
Roll-Up Summary fields calculate values from child detail records directly on a master record.

Key Concept

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