Concretio

View Original

Overcoming Rollup Summary Limitations in Salesforce with LREngine

Rollup summary fields are a common requirement in Salesforce implementations and app development. Rollups are easy to create on master-detail relationships as they are available as a field type. But on certain limits/situations, developers must write an apex code to roll up the child information for common aggregations like COUNT, SUM, AVG, MAX/MIN, etc. Some of these situations are

The ‘USUAL’ approach to handle this limitation is to either

  • Write trigger on various DML(Create, Update, Delete/Undelete) events on child sobject. These triggers manually aggregated the information via Apex or used SOQL Aggregate queries.

  • Write some batch/scheduled apex to perform this nightly.

I tried solving this problem by creating a small Apex utility called “LREngine.” Complete description and details about it are available here on GitHub: https://github.com/abhinavguptas/Salesforce-Lookup-Rollup-Summaries

Update 2020

References