Salesforce Platform Developer I (legacy) — Question 174
When viewing a Quote, the sales representative wants to easily see how many discounted items are included in the Quote Line Items.
What should a developer do to meet this requirement?
Answer options
- A. Create a trigger on the Quote object that queries the Quantity field on discounted Quote Line Items.
- B. Create a Workflow Rule on the Quote Line Item object that updates a field on the parent Quote when the item is discounted.
- C. Create a roll-up summary field on the Quote object that performs a SUM on the quote Line Item Quantity field, filtered for only discounted Quote Line Items.
- D. Create a formula field on the Quote object that performs a SUM on the Quote Line Item Quantity field, filtered for only discounted Quote Line Items.
Correct answer: C
Explanation
The correct answer is C because a roll-up summary field can directly aggregate data from related records, in this case, allowing for a sum of discounted items. Option A is incorrect since triggers do not provide a straightforward way to display aggregated data. Option B does not aggregate data effectively and relies on a Workflow Rule, which is less efficient for this scenario. Option D, while it calculates a sum, does not have the same efficiency and direct relationship as a roll-up summary field.