/declarative-lookup-rollup-summaries

Declarative Rollup Summaries for Lookups

Primary LanguageApexBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Declarative Rollups for Lookups!

Build Status

Features Summary

  • Rollup information between Lookup relationships not previously possible without writing Apex Triggers
  • Define rollups using standard UI declaratively, no coding required
  • Define filter criteria on rollups for example Rollup Amount on Opportunity onto Account for Closed Won
  • Supports Realtime, Scheduled and Developer API modes
  • Open source, available in code and managed package form.
  • Managed package has passed Salesforce Security Review and is Aloha enabled (does not consume app, tab limits)

Please refer to the blog posts below for more detailed information.

Community

This is a community driven tool, please help support it, share your experiences in this Chatter group.

Documentation

The tool has been featured in a number of blog entries as it has evolved...

There is also an early releaes video demonstration here...

Implementation Considerations

  • Check Existings Apex Tests. This tool dynamically deploys Apex Triggers and Apex tests, please make sure your Sandbox and Production org tests are all fully working before you attempt to use this tool. Otherwise usage of this tool will be blocked until you resolve such errors. If you have an org with triggers on the sObject that will contain the roll up result, installation into sandbox is VERY HIGHLY recommended so that after Lookup Rollup Summary records are added/enabled, you should rerun all testmethods to ensure nothing has broken as your before/after update triggers on the parent sObject will re-execute.
  • Existing Tests on Parent Objects. This tool will update the indicated fields on your Parent objects when it senses activity on Child objects. Ensure an Apex Triggers you have written on your Parent objects are written with best practices around bulkification in mind. If in doubt be sure to perform significant testing.

Usage Information and Known Issues

  • Platform SOQL Limits. This tool uses SOQL Aggregate queries and is subject to platform limitations. This basically means...
  • Deployment issues into Production. This tool dynamically deploys a small trigger and test class to the org. This is subject to the same rules and compliances as as a regular human developer. The generate test class, can in some cases be to simplisitc to get code coverage, requiring at present a developer to assist with the deployment, especially to production. There is more details on how to look for this scenario and how to workaround it, as well as future thoughts here.
  • Volume Considerations. For each rollup, there is a maximum of 50,000 child relation records that can be summarised each time child record/s insert/update/delete operations are made (which may process several configured rollups). The rollup processes children to rollup by their parent record relationship and an optional further filter if provided. Meaning so long as this relationship does not result in more than 50,000 child records per parent parent record it will be successful. Take a look at this blog post which describes some new configuration settings (see bottom of blog post) to help calibrate the tool when running the Scheduled or Calculate jobs to help work within the 50,000 row limit.
  • Indexing Fields. For performance reasons ensure the fields used are indexed (lookups are by default) and also any fields used in the filter criteria. This can be very important as without this, a full table scan will occur when the platform executes the SOQL and cause performance issues. For more information from Salesforce please see here and here.
  • Realtime Mode and Formula Fields. When using the Realtime mode, Formula fields as fields to aggregate are not supported (validation will be added in a future release to block this). To work around this, either switch to Scheduled mode or in Relatime mode use a Workflow Field Update to copy the formula field value to a physical field and reference that.
  • Sandbox Testing. While the tool can be installed and enabled directly in production, sandbox testing is still strongly recommended.
  • Professional Edition. Professional Edition is not supported, due to the Metadata API used by the tool not being available in this edition.

Please feel free to raise feedback and issues via the Github Issues page here.

Packaged Release History

You can install a packaged version of the tool into your production org (sandbox testing as always recommended). Check the limatations and known issues above first!

Latest Version 1.23


Package Production URL, Sandbox URL

Version 1.22


Package Production URL, Sandbox URL

If you are upgrading, you will need to make the following changes to the Layout.

  • Add Test Code See All Data field to the layout

Version 1.21


Package Production URL, Sandbox URL

If you are upgrading, you will need to make the following changes to the Layout.

  • Add Test Code field to the layout

Version 1.20


Package Production URL, Sandbox URL

If you are upgrading, you will need to make the following changes to the Layout.

  • Add Calculation Sharing Mode field to the layout

Calculation Sharing Mode

Version 1.19


Package Production URL, Sandbox URL

Version 1.18


Read more about this releae here.

Package Production URL, Sandbox URL

If you are upgrading, you will need to make the following changes to the Layout and Picklists.

  • Add Lookup Rollup Summary Unique Name, Concatenate Delimiter, Field to Order By fields to the layout
  • Add Count Distinct, Concatenate, Concatenate Distinct, First and Last picklist items to Aggregate Operation
  • Add Process Builder picklist item to Calculation Mode

Version 1.17


Package Production URL, Sandbox URL

Version 1.16


Package Production URL, Sandbox URL

Version 1.15


Package Production URL, Sandbox URL

Version 1.14


Package Production URL, Sandbox URL

Version 1.13


Package Production URL, Sandbox URL

Version 1.12


Package Production URL, Sandbox URL

KNOWN ISSUE: Apex Error Query Exception, please use version v1.11 below if you encounter this issue.

  • Fix for Currency Conversion?, special thanks to Anthony Heber for submitting the enhancement to LREngine to fix this. The result of the child aggregation is converted to the parent record currency if the child field being aggregated is a Currency type and the org is using Multi-Currency. Note currently dated exchanged rates (available through Advanced Mulit-Currency) are currently not supported.

Version 1.11


Package Production URL, Sandbox URL

Version 1.10


Package Production URL, Sandbox URL

Version 1.9 - Community Powered!


Read more about this release here

Package Production URL, Sandbox URL

KNOWN INSTALL ISSUE There appears to be an install issue identified when installing into orgs without Ideas installed for v1.9, if you encourter this enable Ideas if you can, otherwise use v1.7 until the issue is resolved.

Version 1.8


Not released

Version 1.7


Package Production URL, Sandbox URL

  • Fix for Issue 14, relating to null pointer exception

Version 1.6 - Spring'14 Release - 9th February 2014


Package Production URL, Sandbox URL

  • Enhancements to support Schedule mode, Calculate historic records, Developer API and more, see here.
  • Fix for Issue 10
  • Fix for Issue 11

Version 1.5


Package Production URL, Sandbox URL

  • Fix for Issue 7 and Issue 8, relating to failure to report test execution errors in production org.

Version 1.4


  • Fix for Issue 3, relating to issue when deleting last child record not updating rollup fields to 0.

Version 1.3


  • Fix for Issue 2, relating to error 'purgeOnDelete option can only be used on a non-active org'

Version 1.2


  • Support for Realtime calculations
  • Validation of valid fields and field types on Declarative Rollup definition fields
  • Optimisation during update of child records to only apply rollup when field to aggregate changes
  • More extensive unit tests, also those around use of limits such as queries, rows etc.

Upload Review Passed

Version Beta 6


  • Support for Realtime calculations
  • Limited validation on Declarative Rollup definition fields
  • Limited testing on multiple lookups
  • Fixed issue with multiple lookups

Installing the Source Code (Developers)

If you are a developer obtain the source code from this repository if you wish to develop it further and/or contribute to it. Click the button below to deploy the source code to your developer or sandbox org.

Deploy to Salesforce

KNOWN INSTALL ISSUE Sometimes the Permission Set files will not deploy, based on org differences, such as features enabled. If you encounter this problem, Clone the repo manually and use your IDE or Ant script to deploy without the Permission Sets. I will be looking into fixing this issue in the future.