Salesforce Certified Platform Developer II — Question 175
Ursa Major Solar has a custom object, ServiceJob_c, with an optional Lookup field to Account called Partner_Service_Provider_c.
The TotalJobs_c field on Account tracks the total number of ServiceJob_c records to which a partner service provider Account is related.
What should be done to ensure that the TotalJobs_c field is kept up to date?
Answer options
- A. Create an Apex trigger on ServiceJob_c.
- B. Change TotalJobs_c to a roll-up summary field.
- C. Implement a workflow cross-object field update.
- D. Build a Process Builder with an invocable action.
Correct answer: B
Explanation
The correct answer is B because a roll-up summary field can automatically calculate the total number of related records (ServiceJob_c) and keep the TotalJobs_c field updated without additional code. An Apex trigger (A) would require manual coding and maintenance, while a workflow (C) does not support counting related records directly. Process Builder (D) can automate processes but is less efficient for this specific requirement compared to a roll-up summary field.