Salesforce-Platform-Developer Practice Test

Salesforce Spring 25 Release
237 Questions

An Opportunity needs to have an amount rolled up from a custom object that is not in a master-detail relationship. How can this be achieved?

A. Write a trigger on the child object and use a red-black tree sorting to sum the amount for all related child objects under the Opportunity.

B. Write a Process Builder that links the custom object to the Opportunity.

C. Write a trigger on the child object and use an aggregate function to sum the amount for all related child objects under the Opportunity

D. Use the Streaming API to create real-time roll-up summaries.

C.   Write a trigger on the child object and use an aggregate function to sum the amount for all related child objects under the Opportunity

Explanation:

When two objects (e.g., a custom object and Opportunity) are not in a master-detail relationship, native roll-up summary fields are not supported. In such cases:

A trigger on the child object can be used to detect inserts, updates, or deletions.
The trigger can perform a SOQL aggregate query (like SUM()) to calculate the total amount.
The result can then be used to update a custom amount field on the related Opportunity.

Salesforce-Platform-Developer Exam Questions - Home Previous
Page 42 out of 237 Pages