Apex

Declarative Apex Roll-Up Summary Framework

A robust Apex framework that allows admins to create roll-up summaries in scenarios not supported by standard Salesforce functionality, such as lookups.

Declarative Apex Roll-Up Summary Framework

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

  1. Download and deploy the Apex classes and custom metadata types.
  2. Create a new Custom Metadata record for your desired roll-up.
  3. Specify the Parent Object, Child Object, Relationship Field, and aggregation logic.
  4. The framework's trigger will automatically handle the rest.

Screenshots

Screenshot 1

Related Solutions

LWC
beginner

LWC Toast Notification Service

A reusable LWC service component that simplifies showing toast notifications from anywhere in your Lightning components.

LWC Toast Notification Service
Apex
intermediate

Invocable Apex for HTTP Callouts in Salesforce Flow

A generic, invocable Apex action that allows flows to make HTTP GET or POST callouts to external APIs without writing custom Apex for each integration.

Invocable Apex for HTTP Callouts in Salesforce Flow
Integration
advanced

Google Drive Integration Snippet (Apex)

An Apex snippet demonstrating how to authenticate with the Google Drive API using OAuth 2.0 and upload a file from Salesforce.

Google Drive Integration Snippet (Apex)