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.

Join and Write Back Data

Join New Rollup Data with Existing Donor Gift Summary Data

You now have a calculation that generates the data to meet the HNMI fundraisers’ goal of having a count of a donor's gifts with a value of $1,000 or more.

But, remember that donor gift summary records have other, standard rollup fields with values generated by the Data Processing Engine template definition. While some donors already have gift summaries, others require the system to create a new gift summary record.

Before you can check if a donor gift summary exists, you need to bring the donor gift summary data into the Data Processing Engine definition. Use a new Data Source node to get donor gift summaries.

  1. In the Data Processing Engine builder, click New Node.
  2. Specify these details:
    • Node Type: Data Source
    • Name: Get Donor Gift Summaries
    • API Name: This field auto-populates with Get_Donor_Gift_Summaries
  3. Save your work.
  4. In the configuration pane for the new node, specify these details:
    • Select Source and Fields: Object
    • Source Object: Donor Gift Summary
  5. Click Select Fields.
  6. Select the checkbox next to the Field column header to choose all the fields, and retain the default aliases.
  7. Save your work in the Select Fields pane.
  8. Save your work in the configuration pane.
  9. Save your work on the definition.

You now have existing donor gift summary data in your Data Processing Engine definition. Separately, you have your count of gifts of $1,000 or more. It’s time to combine that data into a single dataset.

To create a single dataset, add a Join node to your definition.

  1. In the Data Processing Engine builder, click New Node.
  2. Specify these details:
    • Node Type: Join
    • Name: Join Donor Gift Summaries and Gift Transactions
    • API Name: This field auto-populates with Join_Donor_Gift_Summaries_and_Gift_Transactions
  3. Save your work.
  4. In the configuration pane for the new node, specify these details:
    • Join Type: Outer
    • First Source Node: Aggregate Transactions
    • Second Source Node: Get Donor Gift Summaries
  5. Click Select Fields for your first node, Aggregate Transactions.
  6. Select all fields.
  7. Change the alias for DonorId to TransactionDonorId.
  8. Save your work in the Select Fields pane.
  9. Click Select Fields for your second node, Get Donor Gift Summaries.
  10. Select all fields.
  11. Change the alias for DonorId to SummaryDonorId.
  12. Save your work in the Select Fields pane.
  13. In Mapped Fields, specify these details:
    • First Node Field: DonorId
    • Second Node Field: DonorId
  14. Save your work in the configuration pane.
  15. Save your work on the definition.

Notice that you joined data from two nodes—a Group and Aggregate node and a Data Source node—into one dataset. These two datasets are joined on the DonorId field, which is shared across both nodes.

The new join node is the connection between the Donor Gift Summary data source node and the group and aggregate node.

In the Data Processing Engine builder, this build node sits between two nodes and is the source node for the steps that come next.

Add Logic to Your Data Processing Engine Definition

Remember, some donors may not have a donor gift summary related to their account. In this case, a new record has to be created. For donors with a donor gift summary in place, it’s a matter of updating their existing record.

Follow these steps to create a Filter node to separate donors with gift summaries from those without. Then in subsequent steps, you’ll define the proper actions for each group.

  1. In the Data Processing Engine builder, click New Node.
  2. Specify these details:
    • Node Type: Filter
    • Name: Donors Without Donor Gift Summaries
    • API Name: This field auto-populates with Donors_Without_Donor_Gift_Summaries
  3. Save your work.
  4. In the configuration pane for the new node, specify these details:
    • Source Node: Join Donor Gift Summaries and Gift Transactions
    • Select Records When: All Conditions Are Met (AND)
    • Resource: Id
    • Operator: Is Null
  5. Save your work in the configuration pane.
  6. Save your work on the definition.

Notice that the check you perform is looking for null, or non-existent, donor gift summary IDs.

Now create a similar Filter node for donors with related donor gift summaries. Specifically, filter person accounts where the donor gift summary values aren’t null.

  1. In the Data Processing Engine builder, click New Node.
  2. Specify these details:
    • Node Type: Filter
    • Name: Donors With Donor Gift Summaries
    • API Name: This field auto-populates with Donors_With_Donor_Gift_Summaries
  3. Save your work.
  4. In the configuration pane for the new node, specify these details:
    • Source Node: Join Donor Gift Summaries and Gift Transactions
    • Select Records When: All Conditions Are Met (AND)
    • Resource: Id
    • Operator: Is Not Null
  5. Save your work in the configuration pane.
  6. Save your work on the definition.

The path your data takes now branches between the two filters.

The join is the source node for both filters.

Now that your donors are sorted into different datasets, set up the actions for each group.

Create Writeback Objects

In Data Processing Engine, you use the Writeback Object node to create, update, upsert, delete, or overwrite records in Salesforce. This node is how you take all of the work you’ve done in your definition and send it to its final destination.

To meet HNMI’s requirements, you need one Writeback Object node for each of the filters you set up in the last section.

Start with the writeback object following the filter for donors without an existing donor gift summary.

  1. In the Data Processing Engine builder, click New Node.
  2. Specify these details:
    • Node Type: Writeback Object
    • Name: Create New Donor Gift Summary
    • API Name: This field auto-populates with Create_New_Donor_Gift_Summary
  3. Save your work.
  4. In the configuration pane for the new node, specify these details:
    • Source Node: Donors Without Donor Gift Summaries
    • Target Type: Salesforce Object
    • Action Type: Insert
    • Target Object: Donor Gift Summary
    • User with Writeback Permission: Your user account
    • Writeback Sequence: 1
  5. In the first Field Mapping row, specify these details:
    • Source Node Field: TransactionDonorId
    • Target Field: DonorId
  6. Click + Add Row.
  7. In the second Field Mapping row, specify these details:
    • Source Node Field: BigGiftCount
    • Target Field: X1_000_or_More_Gift_Count__c
  8. Save your work in the configuration pane.
  9. Save your work on the definition.

In the node for donors without a donor gift summary, you selected the Action Type of Insert to create a new record. For donors who have an existing donor gift summary, create a Writeback Object node and choose the Action Type of Upsert to update a record.

  1. In the Data Processing Engine builder, click New Node.
  2. Specify these details:
    • Node Type: Writeback Object
    • Name: Update Donor Gift Summary
    • API Name: This field auto-populates with Update_Donor_Gift_Summary
  3. Save your work.
  4. In the configuration pane for the new node, specify these details:
    • Source Node: Donors With Donor Gift Summaries
    • Target Type: Salesforce Object
    • Action Type: Upsert
    • Target Object: Donor Gift Summary
    • User with Writeback Permission: Your user account
    • Writeback Sequence: 2
  5. In the first Field Mapping row, specify these details:
    • Source Node Field: Id
    • Target Field: Id
  6. Click + Add Row.
  7. In the second Field Mapping row, specify these details:
    • Source Node Field: BigGiftCount
    • Target Field: X1_000_or_More_Gift_Count__c
  8. Save your work in the configuration pane.
  9. Save your work on the definition.

Congratulations! Your Data Processing Engine definition is now complete.

The Data Processing Engine canvas showing the definition and nodes you created.

In this unit, you took the calculation for your new rollup field and joined it with existing data. You then applied logic to decide which action to take, and created nodes to take those actions. All of the nodes you need for your new rollup field are now in place in the Data Processing Engine definition.

Next, in the final step, you activate and run your definition, add it to your schedule-triggered flow, and display the value prominently on account records in the correct app.

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