nerdexam
Salesforce

PDI · Question #40

Universal Containers has implemented an order management application. Each Order can have one or more Order Line items. The Order Line object is related to the Order via a master-detail…

The correct answer is A. Roll-up summary field. The best practice to calculate the sum of Order Line Item totals on the parent Order record, given a master-detail relationship, is to use a Roll-Up Summary field.

Submitted by hans_de· Apr 18, 2026Data Modeling and Management

Question

Universal Containers has implemented an order management application. Each Order can have one or more Order Line items. The Order Line object is related to the Order via a master-detail relationship. For each Order Line item, the total price is calculated by multiplying the Order Line item price with the quantity ordered. What is the best practice to get the sum of all Order Line item totals on the Order record?

Options

  • ARoll-up summary field
  • BQuick action
  • CApex trigger
  • DFormula field

How the community answered

(40 responses)
  • A
    75% (30)
  • B
    15% (6)
  • C
    8% (3)
  • D
    3% (1)

Why each option

The best practice to calculate the sum of Order Line Item totals on the parent Order record, given a master-detail relationship, is to use a Roll-Up Summary field.

ARoll-up summary fieldCorrect

A Roll-Up Summary field is the most efficient and declarative way to calculate aggregate values, such as the sum of child record fields, and display them on the master record in a master-detail relationship.

BQuick action

A Quick Action provides a way to launch actions or create records but does not automatically calculate and store aggregated values on a parent record.

CApex trigger

While an Apex trigger could achieve this calculation, it is a programmatic solution and not considered best practice when a declarative option like a Roll-Up Summary field is available for the exact use case.

DFormula field

A formula field can display data from related records but cannot directly aggregate values across multiple child records like summing their totals.

Concept tested: Roll-Up Summary fields for aggregation (SUM)

Source: https://help.salesforce.com/s/articleView?id=sf.fields_about_roll_up_summary_fields.htm&type=5

Topics

#Roll-up summary fields#Master-detail relationships#Declarative automation#Data aggregation

Community Discussion

No community discussion yet for this question.

Full PDI Practice