Using DLRS To Find a Donor’s First Gift Campaign
Using DLRS To Find a Donor’s First Gift Campaign

Using DLRS To Find a Donor’s First Gift Campaign

11/13/2020 by Dustin Cole
Here we’ll take a look at how to use a popular admin tool to find and report on a donor’s first gift campaign.

NPSP out of the box comes with a lot of great donation rollups on the contact and account object. One item notably missing is a rollup to show which campaign (or event) caused a person or organization to donate first. This would allow you to quickly reference on the contact/account object which campaigns have been the most successful in bringing in donors — a very helpful metric! 

Fortunately, this can be solved quite easily with Declarative Lookup Rollup Summary, better known as DLRS. If you are not familiar with DLRS, don’t be intimidated by the long name. In short, DLRS is a simple and powerful tool to allow rollups on Lookup relationships that are typically only reserved for Master-Detail relationships. 

The Goal

Our end goal is an auto-filled rollup field referencing the First Gift Campaign on the contact and account objects.

DLRS in Salesforce Screencap

How to Get There

Step 1: Prerequisites

To get there you will need two things: 

  1. Install Declarative Lookup Rollup Summary (DLRS). Don’t try to install DLRS from the AppExchange. Instead go to the GitHub link referenced here and click on Production or Sandbox to install in the respective instance.  DLRS in Salesforce Screencap
  2. Read (and bookmark) this Guide to Getting Started With DLRS
Step 2: Create Fields

Create Lookup fields titled First Gift Campaign on both the account and contact object that lookup to the Campaign object. The API name will be First_Gift_Campaign__c. These should be read-only for all profiles to avoid users trying to fill this out. 

Add these to the page layouts. I suggest placing it just below the First Gift Date field. 

Step 3: Create the DLRS

Navigate to the Manage Lookup Rollups tab and create a new DLRS. This one will be for the Account. The parameters will be as follows: 

  • Lookup Rollup Summary Name: Account-First Gift Campaign
  • Lookup Rollup Summary Unique Name: Account_First_Gift_Campaign
  • Parent Object: Account
  • Child Object: Opportunity
  • Relationship Field: AccountId
  • Relationship Criteria: isWon = TRUE
  • Relationship Criteria Fields: isWon
  • Field to Aggregate: CampaignID
  • Field to Order By: CloseDate
  • Aggregate Operation: First
  • Aggregate Result Field: First_Gift_Campaign__c
  • Calculation Mode: Realtime
  • Calculation Sharing Mode: User
  • Active: FALSE

Note: To activate a DLRS for the first time you’ll need to create DLRS as inactive first, then go to “Manage Child Trigger” and deploy the trigger. Then go back to the DLRS and activate. 

After activating the DLRS, hit Calculate to fill in the fields for the first time. And hit Schedule Calculate to schedule the rollup to happen on your preferred schedule. The default settings will likely suffice for most organizations and will update fields daily at 2am. 

DLRS in Salesforce Screencap

To create the DLRS for Contact use the same parameters as above and change the following: 

Parent Object: Contact

Relationship Field: npsp__Primary_Contact__c

And that’s all there is to it. What are some of your favorite DLRS use cases? Let’s hear them in the comments below, on the Salesforce Success Community, on the Power of Us Hub, or right at me on twitter @dustinmcole