Salesforce Platform Developer I (legacy) — Question 241
Which approach should a developer take to automatically add a `Maintenance Plan` to each Opportunity that includes an `Annual Subscription` when an opportunity is closed?
Answer options
- A. Build a OpportunityLineItem trigger that adds a PriceBookEntry record.
- B. Build an OpportunityLineItem trigger to add an OpportunityLineItem record.
- C. Build an Opportunity trigger that adds a PriceBookEntry record.
- D. Build an Opportunity trigger that adds an OpportunityLineItem record.
Correct answer: D
Explanation
The correct answer is D because it specifies using an Opportunity trigger to add an OpportunityLineItem when the status of the opportunity is closed. Options A and C incorrectly involve PriceBookEntry records, which do not directly relate to the task of adding a Maintenance Plan. Option B fails to address the closing state of the Opportunity, which is critical for this scenario.