nerdexam
Salesforce

PDI · Question #57

An org tracks customer orders on an Order object and the items of an Order on the Line Item object. The Line Item object has a MasterDetail relationship to the order object. A developer has a…

The correct answer is A. Implement the line amount as a numeric formula field and the order amount as a roll-up summary. The line item amount should be a formula field calculating Quantity * Price, while the order amount should be a roll-up summary field on the Order object summing the line item amounts from its master-detail child records.

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

Question

An org tracks customer orders on an Order object and the items of an Order on the Line Item object. The Line Item object has a MasterDetail relationship to the order object. A developer has a requirement to calculate the order amount on an Order and the line amount on each Line item based on quantity and price. What is the correct implementation?

Options

  • AImplement the line amount as a numeric formula field and the order amount as a roll-up summary
  • BWrite a single before trigger on the Line Item that calculates the item amount and updates the
  • CImplement the Line amount as a currency field and the order amount as a SUM formula field.
  • DWrite a process on the Line item that calculates the item amount and order amount and updates

How the community answered

(43 responses)
  • A
    88% (38)
  • B
    2% (1)
  • C
    7% (3)
  • D
    2% (1)

Why each option

The line item amount should be a formula field calculating Quantity * Price, while the order amount should be a roll-up summary field on the Order object summing the line item amounts from its master-detail child records.

AImplement the line amount as a numeric formula field and the order amount as a roll-up summaryCorrect

The line amount, being a calculation of fields on the same Line Item record (quantity * price), is best implemented as a formula field for real-time calculation. The order amount, being a sum of child Line Item amounts in a Master-Detail relationship, is perfectly suited for a Roll-Up Summary field on the Order object.

BWrite a single before trigger on the Line Item that calculates the item amount and updates the

While a trigger could achieve this, declarative solutions (formula and roll-up summary fields) are preferred when available for lower maintenance and faster development, especially for straightforward calculations.

CImplement the Line amount as a currency field and the order amount as a SUM formula field.

A "SUM formula field" is not a standard declarative field type in Salesforce; roll-up summary fields are used for aggregation across related records in master-detail relationships.

DWrite a process on the Line item that calculates the item amount and order amount and updates

A Process Builder could potentially update fields, but it would be less efficient and higher maintenance than a formula field for the line amount and a roll-up summary for the order amount, both of which are declarative and automatically handled.

Concept tested: Formula and Roll-Up Summary fields

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

Topics

#Formula Fields#Roll-up Summary Fields#Master-Detail Relationship#Declarative Development

Community Discussion

No community discussion yet for this question.

Full PDI Practice