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?
- 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
- BCreate 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.
- CCreate a single Master-Detail relationship field on the Software Application object pointing to Workstation to aggregate licensing costs.
- DCreate 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
Key Concept
Many-to-Many Relationships and Roll-Up Summary Field Capabilities