Skip to main content
TDX, the developer conference for the AI agent era is happening now. Watch live on Salesforce+ for exclusive digital content, a revolutionary keynote, and more.

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.

  1. From Setup, in the Quick Find box, enter data processing, and then select Data Processing Engine.
  2. Click DonorGiftSummary.
  3. Click save-as or delete-menu and select Save As.
  4. 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
  5. Save your work.
  6. 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 active copy of the Data Processing Engine template definition.

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.

A simplified flowchart of the Data Processing Engine nodes that calculate and write back 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.

You can meet the fundraisers’ requirements at HNMI with these nodes.

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.

  1. From Setup, in the Quick Find box, enter flows, and then select Flows.
  2. Click New Flow.
  3. Select Start From Scratch and click Next.
  4. Select Schedule-Triggered Flow and click Create.
  5. In the Set a Schedule panel, specify these details:
    • Start Date: Tomorrow’s date
    • Start Time: Midnight
    • Frequency: Weekly
  6. Click Add element between the start and end elements.
  7. Find and select the Action element.
  8. Find and select DonorGiftSummary-Active-DataProcessingEngine.
  9. 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
  10. 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)
    • Click Check Syntax.
    • Click Done.
  11. 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)
    • Click Check Syntax.
    • Click Done.
  12. 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)
    • Click Check Syntax.
    • Click Done.
  13. 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
  14. Save your work.

Your flow contains three elements: Start, an Action, and End. It’s ready to go.

The resulting flow on the Flow Builder canvas.

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.

Note

Tip

This flow only runs the donor gift summary Data Processing Engine definition, but you can run multiple definitions in the same flow. Set up one schedule-triggered flow to run all of your regularly occurring Data Processing Engine definitions.

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.

  1. From Setup, click Object Manager.
  2. Find and select Donor Gift Summary.
  3. Select Fields & Relationships.
  4. Click New.
  5. Select Number and click Next.
  6. Specify these details:
    • Field Label: $1,000 or More Gift Count
    • Field Name: This field auto-populates with X1_000_or_More_Gift_Count
  7. Click Next.
  8. Click Next.
  9. 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.

Resources

Verify Step

+100 points

You’ll be completing this project in your own hands-on org. Click Launch to get started, or click the name of your org to choose a different one.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback