PDI · Question #141
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…
The correct answer is A. Line Item has a re-parentable master-detail field to Order. To support rollup summaries on an Order and allow Line Items to be re-parented between Orders, a re-parentable master-detail relationship where Line Item is the child of Order is required.
Question
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 own7
Options
- ALine Item has a re-parentable master-detail field to Order.
- BOrder has a re-parentable master-detail field to Line Item.
- CLine Item has a re-parentable lookup field to Order.
- DOrder has a re-parentable lookup field to Line Item.
How the community answered
(45 responses)- A76% (34)
- B2% (1)
- C16% (7)
- D7% (3)
Why each option
To support rollup summaries on an Order and allow Line Items to be re-parented between Orders, a re-parentable master-detail relationship where Line Item is the child of Order is required.
A master-detail relationship with Line Item as the child and Order as the master allows for rollup summary fields on the Order object, and making the master-detail field re-parentable enables moving Line Items between different Orders.
A master-detail relationship where Order is the child of Line Item is inverse and prevents rollup summaries on the Order object from its Line Items, and would not allow re-parenting Line Items to different Orders.
A lookup relationship does not support rollup summary fields, which are necessary for calculating the total amount on an Order from its Line Items.
A lookup relationship does not support rollup summary fields on the parent object, making it unsuitable for calculating the total amount on an Order based on its Line Items.
Concept tested: Salesforce master-detail relationships
Source: https://help.salesforce.com/s/articleView?id=sf.overview_of_custom_object_relationships.htm&type=5
Topics
Community Discussion
No community discussion yet for this question.