Plat-Dev-201 practice question 17 of 30

A developer has the following requirements: • Calculate the total amount on an Order. • Calculate the line amount for each Line Item based on quantity selected and price. • Move Line Items to a different Order if a Line Item is not in stock. Which relationship implementation supports these requirements on its own?

Full set: 204 questions
Answer options
A: Line Item has a re-parentable master-detail field to Order. Correct answer
B: Line Item has a re-parentable lookup field to Order.
C: Order has a re-parentable lookup field to Line Item.
D: Order has are-parentable master-detail field to Line Item.
Correct Answer:
A. Line Item has a re-parentable master-detail field to Order.
Explanation

The requirements necessitate a relationship that supports both roll-up summary fields and the ability to re-parent child records. A master-detail relationship is required to create roll-up summary fields, which can calculate the total amount on the Order from its Line Items. A standard master-detail relationship locks the child record to the parent, but enabling the "Allow reparenting" option on the relationship field allows a child Line Item to be moved to a different parent Order. This single relationship type fulfills all stated requirements.

Why Incorrect

B. A lookup relationship does not support roll-up summary fields, failing the requirement to calculate the total amount on the Order.
C. This inverts the object relationship. An Order having a lookup to a Line Item is illogical for a sales model.
D. This inverts the object relationship, making the Order a child of the Line Item, which is functionally incorrect for this scenario.

References

1. Salesforce Help, Object Relationships Overview. "Master-Detail" section: "The master-detail relationship is a strongly coupled relationship... It also allows you to create roll-up summary fields."

2. Salesforce Help, Create a Master-Detail Relationship. Step 7 describes the "Allow reparenting" option: "Select Allow reparenting to allow a child record in a master-detail relationship to be reparented to a different parent record."

3. Salesforce Object Model and Custom Objects, Trailhead. "Understand Relationship Fields" unit.

Scroll to Top