Salesforce Platform Developer I (legacy) — Question 269
Universal Containers uses a simple Order Management app. On the Order Lines, the order line total is calculated by multiplying the item price with the quantity ordered. There is a Master-Detail relationship between the Order and the Order Lines object.
What is the best practice to get the sum of all order line totals on the order header?
Answer options
- A. Declarative Roll-Up Summaries App
- B. Roll-Up Summary field
- C. Process Builder
- D. Apex Trigger
Correct answer: B
Explanation
The best practice for aggregating values from child records in a Master-Detail relationship is to use a Roll-Up Summary field, as it allows for automatic calculations without additional overhead. The Declarative Roll-Up Summaries App is not as direct and requires setup, while Process Builder and Apex Trigger would involve more complexity and are not necessary for this straightforward summation task.