Step 5. 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.

Create a New Flow Screenshot


Drag the Get Records Element onto the Canvas

Label this Get Contact Record, and the API Name will auto-fill. 

Get Contact Records Set Up 1
Get Contact Object 2


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

 

Choose Variables Screenshot


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

Get Decision Set Up

 

Drag a Create Record element onto the Canvas and name it Create New Contact. This is the branch of the decision we will take if there is no existing contact. Set the Field Values for the Contact. 

Create New Contact Record

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. 

Second Decision Element
We only want to create a new Donation (Opportunity) record if the Donation is successful, but we bought in the information about failed recurring donations from Raisely so that we can alert our Fundraising team via a chatter alert.
Recurring donations often fail when credit cards expire or when people use Debit Visa or Mastercards and they empty their accounts. Raisely automatically retries the card several times, but its amazing donor care for your Fundraising team to make a call after a few days and confirm why the transaction has not gone through. 
Action post to chatter
Drag a third Decision Element onto the canvas 
Event Type Decision Element
This decision considers whether the donation is once off or recurring. If it is once off we create the donation record.

Drag a Create Record Element onto the Canvas

Create Opportunity 1
Create Opportunity 2
As you can see from above there are many fields to map from the Raisely Data but there are also other fields with different values:

  1. Stage Name and Acknowledgement Status are text values
  2. 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.

Get recurring Donations 1

Get recurring Donations 2

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 a new text variable for the Recurring Donation ID and a new number variable for the Number of Installments, and stored them 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.

First recurring donation?

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.

Find Campaign Name

Then we create the new Recurring Donation. Drag the Create Records Element onto the Canvas.

Create New Recurring Donation 1

Create New Recurring Donation 2

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

Get Opp Id 1Get Opp Id 2

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.

Update Opp Record 1Update Opp Record 2

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? 

Drag a Get Records Element onto the Canvas

Get Next Pledged Opportunity 1

Get Next Pledged Opportunity 2

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. 

Drag an Update Record Element onto the Canvas

Update the Opportunity 1

Update the Opportunity 2

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.

You can map to the standard Payment Fields

Payment Method --> Payment Method (Please ensure the picklist values match and you cannot promote this to a global value set as its part of the NPSP managed package)

Receipt Number --> Check/Reference Number

Payment Update Record

Now we connect each Element on the Canvas with arrows. Here is a recap of the entire flow.

Final 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.

 

All News