Salesforce Platform Developer I (legacy) — Question 104
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?
Answer options
- A. Order has a Lookup field to Line Item and there can be many Line Items per Order.
- B. Line Item has a Lookup field to Order and there can be many Line Items per Order.
- C. Order has a Master-Detail field to Line Item and there can be many Line Items per Order.
- D. Line Item has a Master-Detail field to Order and the Master can be re-parented.
Correct answer: D
Explanation
The correct answer is D because a Master-Detail relationship allows for the re-parenting of Line Items to different Orders, which is crucial when items are out of stock. Options A and B do not provide sufficient control over the relationship dynamics necessary for transferring items, while option C does not allow for re-parenting, making it unsuitable for this scenario.