Problem
Standard Salesforce roll-up summary fields only work on master-detail relationships. Calculating roll-ups across lookup relationships or more complex logic requires writing custom triggers for each object, which is inefficient and hard to maintain.
Solution Overview
This framework provides a custom metadata-driven solution. Admins define the roll-up logic (parent object, child object, fields to aggregate) in custom metadata records. A set of generic Apex triggers handles the calculations, making it scalable and reusable.
How to Deploy
- Download and deploy the Apex classes and custom metadata types.
- Create a new Custom Metadata record for your desired roll-up.
- Specify the Parent Object, Child Object, Relationship Field, and aggregation logic.
- The framework's trigger will automatically handle the rest.