Prepare for Your New Rollups
Get Ready to Roll Up
Before you create a custom rollup field using Data Processing Engine, you need to do some preparation work.
To meet HNMI’s requirements, enable the standard Donor Gift Summary rollup fields, and add a custom field to store the count of a donor’s gifts of $1,000 or more.
In this step, you complete those tasks. Plus, you learn more about how Data Processing Engine works by examining the flow of data through the Data Processing Engine template definition. Now it’s time to access your Developer Edition org, and use it to complete all the steps in this project.
Clone the Donor Gift Summary Template Definition
Fundraising includes two Data Processing Engine template definitions for calculating the values of rollup fields. For this project, you make a copy of the template definition that populates the Donor Gift Summary object. Then you activate and use your copy. This keeps the original template definition intact.
- From Setup, in the Quick Find box, enter
data processing
, and then select Data Processing Engine.
- Click DonorGiftSummary.
- Click
and select Save As.
- Specify these details:
- Name:
DonorGiftSummary-Active
- API Name: This field auto-populates with
DonorGiftSummary_Active
- Process Type: Standard
- Description:
Active copy of the DonorGiftSummary template
- Name:
- Save your work.
- Click Activate.
You now have an active definition to use for populating fields on the Donor Gift Summary object. Here’s a screen capture of what you should see in Data Processing Engine.
The definition looks complicated because it has many nodes performing many calculations. But not to worry—in the next section you gain an understanding of data processing nodes.
Explore Data Processing Nodes
While there are many calculations to consider, the most relevant for this project is the existing Gift Count field on donor gift summaries because it resembles what you’re going to build. Data Processing Engine calculates Gift Count by counting all of the donor’s paid gift transactions. Learn more about it from the DonorGiftSummary page in Developer documentation.
Because the Gift Count calculation is part of a larger definition that calculates many different values, it can be hard to follow. Here’s a simplified, isolated view of the nodes that calculate and store the Gift Count value.
Generally, a Data Source node gets data from Gift Transactions, and a Filter node narrows down the dataset to paid transactions only. Slice nodes further trim the data to select fields.
To calculate the Gift Count value, a Group and Aggregate node uses a built-in function to count all of the gift transactions for each donor. The data from this node then passes through Join, Filter, and Formula nodes to combine with information from other parts of the Data Processing Definition.
Finally, two Filter nodes separate the donors who have an existing donor gift summary from those who don’t. Two Writeback nodes take action for each donor group, either updating or creating a donor gift summary.
To meet the requirements of HNMI’s fundraisers, you create a similar structure in this project.
These concepts might be overwhelming now, but in this project you learn more about each node as you build the solution.
Before you move on, though, make sure the default rollup data is updated regularly with a schedule-triggered flow.
Create a Schedule-Triggered Flow
Data Processing Engine definitions are powerful, but they don’t run on their own. To keep the rollup data current, you can run definitions in flows. Use Flow Builder to create a schedule-triggered flow now.
- From Setup, in the Quick Find box, enter
flows
, and then select Flows.
- Click New Flow.
- Select Start From Scratch and click Next.
- Select Schedule-Triggered Flow and click Create.
- In the Set a Schedule panel, specify these details:
- Start Date: Tomorrow’s date
- Start Time: Midnight
- Frequency: Weekly
- Start Date: Tomorrow’s date
- Click
between the start and end elements.
- Find and select the Action element.
- Find and select DonorGiftSummary-Active-DataProcessingEngine.
- Specify these details:
- Label:
Run DonorGiftSummary-Active
- API Name: This field auto-populates with
Run_DonorGiftSummary_Active
- Description:
Runs a copy of the DonorGiftSummary data processing engine definition template
- Label:
- Create a variable for the CURRENT_CALENDAR_YEAR field.
- Click in the field and choose + New Resource.
- Specify these details:
- Resource Type: Formula
- API Name:
Current_Year_Start_Date
- Data Type: Date
- Formula:
DATE(YEAR({!$Flow.CurrentDate}),1,1)
- Resource Type: Formula
- Click Check Syntax.
- Click Done.
- Click in the field and choose + New Resource.
- Create a variable for the LAST_CALENDAR_YEAR field.
- Click in the field and choose + New Resource.
- Specify these details:
- Resource Type: Formula
- API Name:
Previous_Year_Start_Date
- Data Type: Date
- Formula:
DATE(YEAR({!$Flow.CurrentDate})-1,1,1)
- Resource Type: Formula
- Click Check Syntax.
- Click Done.
- Click in the field and choose + New Resource.
- Create a variable for the LAST_TWO_CALENDAR_YEAR field.
- Click in the field and choose + New Resource.
- Specify these details:
- Resource Type: Formula
- API Name:
Last_Two_Calendar_Year
- Data Type: Date
- Formula:
DATE(YEAR({!$Flow.CurrentDate})-2, 1, 1)
- Resource Type: Formula
- Click Check Syntax.
- Click Done.
- Click in the field and choose + New Resource.
- Save the flow and specify these details:
- Flow Label:
Donor Gift Summary Schedule Triggered Flow
- Flow API Name: This field auto-populates with
Donor_Gift_Summary_Schedule_Triggered_Flow
- Description:
Runs all donor gift summary Data Processing Engine definitions one time each week
- Flow Label:
- Save your work.
Your flow contains three elements: Start, an Action, and End. It’s ready to go.
Typically, at this point you would activate the flow. But hold off on doing this in your Developer Edition org, because this data doesn’t change over time. We only validate that the flow exists, not that it’s active.
Add a Field to the Donor Gift Summary Object
Now you’re ready to populate the default Donor Gift Summary fields, so it’s time to start building the new rollup for the fundraisers at HNMI.
Before setting up the new Data Processing Engine definition, you need a place to store the information it calculates. Create a custom field on the Donor Gift Summary object to hold the calculated data.
- From Setup, click Object Manager.
- Find and select Donor Gift Summary.
- Select Fields & Relationships.
- Click New.
- Select Number and click Next.
- Specify these details:
- Field Label:
$1,000 or More Gift Count
- Field Name: This field auto-populates with
X1_000_or_More_Gift_Count
- Field Label:
- Click Next.
- Click Next.
- Save your work.
The new field is ready to store a custom rollup calculation!
In this step, you copied, activated, and scheduled a Data Processing Engine definition for all of the standard Fundraising rollups on the Donor Gift Summary object. You also created a custom field to store your new rollup data. In the next step, you start to build a custom Data Processing Engine definition to generate the rollup data.