Saturday, July 2, 2016

Declarative Rollups for Lookups

Declarative Lookup Rollup Summaries Tool is one of the most popular free tool for Salesforce admin built by fellow Salesforce MVP - Andrew Fawcett.

Out of the box, Salesforce support Roll-Up Summary field when the parent-child relation is Master-Detail relationship. But in many cases, we have to use Lookup relationship, example: sharing setting, when the child record owner may differ with parent record owner, and etc.

Without this tool, you need to engage developer to write trigger (and test class) in child object to roll-up the value to the designated parent field. With Declarative Lookup Rollup Summaries Tool, as admin, we just need to install the package and do a simple configuration to enable it, you can choose either real-time or scheduled (hourly, daily, weekly, etc).

To get full documentation, discussion and issues, go to GitHub and join Declarative Lookup Rollup Summaries Tool success community for discussion and questions
This blog will just explain basic steps to install and configure the tool:

1. Install Package 
Current version 2.4.2 when this blog written - for Production; or for Sandbox.

2. Create Remote Site Setting
Once the packaged install, navigate to "Welcome" tab and click "Create Remote Site Setting" button.
This step will create a new Remote Site URL in your Salesforce org.

3. Create Lookup Rollup Summary
Navigate to tab "Manage Lookup Rollup Summaries" and enter required information.

In this sample, I would like to count number of Lane records and roll-up to Opportunity object. You cannot select Active at this moment until deploy the child trigger. So, just save this without select Active checkbox.

4. Deploy Child Trigger
Click "Manage Child Trigger" button and click "Deploy" button. This step will create a trigger in the child object.

5. Activate the Lookup Roll-up
Navigate back to "Manage Lookup Rollup Summaries" tab and select Lookup Rollup Summary created, now you should be able to enable Active checkbox to activate the roll-up configured.

6. Real-time or Scheduled
In the "Calculation Mode" you can choose Real-time or Scheduled (we will not discuss Developer and Process Builder in this blog).
Select Real-time will auto calculate when child record added, modified or deleted. Select Scheduled, you need to schedule when the calculation trigger, click "Schedule Calculate" button to schedule when it will be triggered, by a specific hour, hourly, specific day, etc. Example: you can configure multiple hour, such as: daily 2 AM and 6 AM by hold Ctrl key when click.

You can monitor next scheduled run from Setup | Jobs | Scheduled Jobs.

If you configure the calculation mode as Real-time on existing child object with records, parent record will not be auto populate with the roll-up value until there is activity in a related child record, either create, update or delete. So, you may need to create another roll-up with Scheduled to calculate existing values.

Type: Managed Package; Private Listing

Paid/Free: Free

Publisher: Andy in the Cloud

Version: 2.4.2

Blog last update: 2 Jul 2016

No comments:

Post a Comment