Step 4. How to Build a Flow to Process Data
Now that we have captured all the Raisely data into a custom object in Salesforce, we can use a Flow to process the data.
Before attempting your first flow, we recommend you complete the Automate Your Business Processes with Lightning Flow Trail on Trailhead.
Create a New Flow
Got to SetUp > Flows > Create a New Flow. Choose a Record-Triggered Flow. Choose the Object Get Raisely Data.
Drag the Get Records Element onto the Canvas
Label this Get Contact Record, and the API Name will auto-fill.
The following conditions must be met - when the first and last name and email address all match.
Choose the values for the three fields from the Global Variables $Record Get_Raisely_Data__C
Under Sort Order, choose Only the first record to store and Choose fields and assign variables (advanced) under How to Store Record Data.
We need to create a new Resource to store the Field values in. Choose Variable for the Type, add API Name MatchedContact. A resource is a placeholder.
Data Type is Record, don't allow multiple values, choose the Contact Object and make available for both input and output. Hit done.
Then drag the Decision Element onto the Canvas
Drag a Create Record element onto the Canvas and name it Create New Record. This is the branch of the decision we will take if there is no existing contact. Set the Field Values for the Contact.
We find the values for the Field Values from the either the Get Raisely Data for First and Last Name, Email, Mobile and Newsletter Opt In (we created a custom field for this to map the donors permission from our donation landing page into what ever mass email tool we use).
We are assigning the field LeadSource to Raisely Donor with the value Raisely Donor - this is not essential.
Next drag another Decision Element onto the Canvas.
- Stage Name and Acknowledgement Status are text values
- Acknowledgement Date and Close Date are taken from the flow
We choose to Store Opportunity ID in a Variable to use with recurring donations in another branch of the flow.
Also - set channel on the Opportunity object to Raisely.
Next Drag a Get Records element onto the Canvas and name this Get Recurring Donation ID.
The Subscription UUID is a unique ID from Raisely for each recurring donation that is established and this data is passed with each subsequent recurring donation.
In this instance we have created new variables for the Recurring Donation ID and the Number of Installments stored as separate variables.
Now we drag our final Decision Element onto the Canvas. Here we establish whether this is the first Recurring Donation or not.
If this is the first recurring donation we need to create a new recurring donation record, but first we need to know what Campaign the donor has responded to.
Because we map the ID from Raisely (not the Campaign name) we need to find the Campaign Name as it is a required field for setting up a new Recurring Donation.
Then we create the new Recurring Donation. Drag the Create Records Element onto the Canvas.
Note each field value above and how it is set - some from the Raisely Data, date from the flow, 2 variables and a text value for Installment period.
Next Drag a Get Records Element onto the Canvas
Here we are looking for the ID of the first Donation (Opportunity) record created by the Recurring Donation so that we can update the all fields in the Donation (Opportunity) record. We also use this variable to update the Payment record.
Note the sort order is ascending by close date.
We map some of the custom fields we created such as the donation anonymity, the donor message and the Business Name for receipt.
As we explained previously some donors like to make their donations in their business name but we do not recommend you create an account for every donation with a business name automatically. Why create an account record for a $5 gift for Judy's Mobile Tanning Salon?
Now we want to go back to the Final Decision about whether the Recurring Donation is the first one or not.
Drag a Get Records Element onto the Canvas
Note the sort order. What we are trying to do here is find the next Donation (Opportunity) record that was created by the recurring Donation when it was established. The NPSP has this amazing workflow that creates the next 12 donations as pledges which is brilliant for forecasting.
Drag an Update Record Element onto the Canvas
So this is very simple - we want to update the Donation (Opportunity) record to posted.
Now for the final step - drag an Update Record Element onto the Canvas. Here we want to bring all three branches of the flow back to one final step which is to update the related Payment Record for each Donation (Opportunity) record with our custom Payment Method and Receipt Number.
Now we connect each Element on the Canvas with arrows. Here is a recap of the entire flow.
Now you test! You can test how the data comes from Raisely via Zapier by making offline Donations in Raisely.
In this flow Process Data: Raisely to Objects Flow we excluded offline donations from Raisely progressing past the second decision as they are Event Type donation:created and do not meet the requirement.
You can clone the Get Raisely Data records and change field values to test various combinations.
Once you are confident that the flow works as expected - then you need to Test with real donors - so invite your team or volunteers to test and give you feedback.
Finally - make sure you have your email templates for receipts set up beautifully in Raisely - on brand and customised for your cause.