Salesforce Platform Developer I (legacy) — Question 208
A company has a custom object, Sales_Help_Request__c, that has a Lookup relationship to Opportunity. The Sales_Help_Request__c has a number field, Number_of_Hours__c, that represents the amount of time spent on the Sales_Help_Request__c.
A developer is tasked with creating a field, Total_Hours__c, on Opportunity that should be the sum of all of the Number_of_Hours__c values for the Sales_Help_Request__c records related to that Opportunity.
What should the developer use to implement this?
Answer options
- A. A roll-up summary field on the Opportunity object
- B. A trigger on the Opportunity object
- C. A record-triggered flow on the Sales_Help_Request__c object
- D. A roll-up summary field on the Sales_Help_Request__c object
Correct answer: C
Explanation
The correct answer is C, as a record-triggered flow on the Sales_Help_Request__c object can efficiently calculate and update the Total_Hours__c field on the related Opportunity whenever a Sales_Help_Request__c record is created or updated. Option A is incorrect because roll-up summary fields cannot be used in this context since they only work from parent to child and not the other way around. Option B is also not suitable as a trigger would require more complex coding and maintenance. Option D is incorrect because roll-up summary fields cannot be created on the child object (Sales_Help_Request__c) to summarize data to the parent (Opportunity).