Set Up and Modify Flows

Define Accrual Requirements

Since the new loyalty program is expected to have many new members doing constant transactions, the accrual of points and other benefits needs to be smooth and instant. As soon as a member makes a purchase, they should be credited the points they are eligible for. 

Every time a member performs an activity that earns them points, an accrual transaction takes place. The automatic crediting of points is triggered by a flow in Loyalty Management. The purpose of a flow is to collect data and perform an action.

Let’s follow along as Mary and Jose create an accrual flow for the automatic crediting of points.

Here's a recap of the requirements for points.

  • Credit members with 1 qualifying and non-qualifying point each on every dollar spent.
  • Credit members with 100 non-qualifying bonus points on the purchase of LevelX shoes.

Create an Accrual Flow

With the requirements at hand, Jose sets out to create an accrual flow.

Note

Note

In this step, we create a flow that is specific to the requirements of the LevelUp loyalty program. See Flow Basics if you are new to flows. 

There are several types of flows that Jose can choose from. He considers his options and decides to choose an autolaunched flow because he wants the flow to launch automatically when a record changes. 

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. Click New Flow.
  4. Select Autolaunched Flow (No Trigger).
  5. Click Next.
  6. Select Freeform.
Note

Note

Ensure that you are following the instructions and providing the variables as mentioned in this Step (Set Up and Modify Flows). You may not see the desired results in Step 5 (Add Members and Run Flows) if you miss any variable.  

To build the actual flow, Jose makes use of resources, elements, and connectors. A resource represents a value that you can reference throughout the flow. Since most of the data will be collected from the transaction journal, Jose creates a variable resource for the transaction journal record. So at any point in the flow, when he needs to reference the transaction journal, the details are pulled from this variable resource.

  1. On the Manager tab, click New Resource.
  2. Provide the following details.
    • Resource Type: Variable
    • API Name: InputTransactionJournal
    • Data Type: Record
    • Object: Transaction Journal
  3. Select Available for input.
  4. Click Done.

The New Resource window where you create the variable for a transaction journal record.

He then proceeds to put together the elements required for the flow. Each element represents an action that the flow can execute. First, he creates an Action element that credits non-qualifying points based on the transaction amount.

  1. On the Elements tab, drag the Action element onto the canvas, and provide the following details.
    • Filter by: Loyalty
    • Action: Credit Points
    • Label: Credit Non-Qualifying Points Based on Order Amount
    • Program: LevelUp
    • Currency Type: Member Points
    • Recipient Member ID: {!InputTransactionJournal.MemberId}
    • Number of Points to Credit: {!InputTransactionJournal.TransactionAmount}
    • Journal ID: {!InputTransactionJournal.Id}
  2. Click Done.

The New Action window where you enter values required to credit points.

Note

Note

If you encounter an error after entering the value {!InputTransactionJournal.MemberId} in the Recipient Member ID field, click inside the field and select the related object from the menu: select Input Transaction Journal > MemberId (Program Member ID).

This action pulls up the member ID and the transaction amount from the transaction journal and credits member points, or non-qualifying points, equivalent to the transaction amount. 

Next, Jose creates a Get Records element to fetch details of the promotion associated with the loyalty program.

  1. Drag the Get Records element onto the canvas, and provide the following details.
    • Label: Get Level X Promotion
    • Object: Promotion
    • Condition Requirements: All Conditions Are Met (AND)
    • Field: Name
    • Operator: Equals
    • Value: Bonus points for purchase of LevelX shoes
  2. Click Done.

The New Get Records window where you define the parameters required to get promotion details.

The promotion associated with the LevelUp loyalty program is called “Bonus points for purchase of LevelX shoes”. So this element only checks if the promotion name is the same as the one that was created for this program. 

Jose creates another Get Records element to pull information from the Promotion Loyalty Partner Product record and filter records with the following conditions.

  • The Promotion ID is the same as that of the loyalty program, and the Product Category ID is the same as that of the transaction journal.
  • The Promotion ID is the same as that of the loyalty program, and the Product ID is the same as that of the transaction journal.
  1. Drag the Get Records element onto the canvas, and provide the following details.
    • Label: Get Matching Promotion Product Records
    • Object: Promotion Loyalty Partner Product
    • Condition Requirements: Custom Condition Logic Is Met
    • Condition Logic: 1 AND ((2 AND 4) OR (3 AND 5))
  2. Provide the following details in the Field, Operator, and Value fields and click Done.
Line No.
Field
Operator
Value

1

PromotionId

Equals

{!Get_Level_X_Promotion.Id}

2

ProductCategoryId

Equals

{!InputTransactionJournal.ProductCategoryId}

3

LoyaltyProductId

Equals

{!InputTransactionJournal.ProductId}

4

ProductCategoryId

Is Null

{!$GlobalConstant.False}

5

LoyaltyProductId

Is Null

{!$GlobalConstant.False}

The New Get Records window where you define the parameters to identify if the promotion is applicable.

He then creates a Decision element that evaluates if at least one partner product record is available. 

  1. Drag the Decision element onto the canvas, and provide the following details.
    • Label: Does Promotion Apply On Transaction?
    • In the Outcome Details Label: Yes
    • Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    • Resource: {!Get_Matching_Promotion_Product_Records}
    • Operator: Is Null
    • Value: {!$GlobalConstant.False}
  2. Click Done.

The New Decision window where you define the parameters to check if the promotion applies to the transaction.

Based on the records that get filtered by the Get Records element, Get Matching Promotion Product Records, the Decision element checks if the promotion applies to the transaction.

Jose must define an action for the outcome if the promotion applies to the transaction. The Action element checks for the member ID based on the transaction journal and credits the member with 100 points. Here’s how he creates the Action element. 

  1. Drag the Action element onto the canvas, and provide the following details.
    • Filter by: Loyalty
    • Action: Credit Points
    • Label: Credit Points for Promotion
    • Program: LevelUp
    • Currency Type: Member Points
    • Recipient Member ID: {!InputTransactionJournal.MemberId}
    • Number of Points to Credit: 100
    • Journal ID: {!InputTransactionJournal.Id}
  2. Click Done.

The New Action window where you enter values required to credit points.

Jose has to add another Action element that credits members qualifying points for their purchase. Here’s what he does.

  1. Drag the Action element onto the canvas, and provide the following details.
    • Filter by: Loyalty
    • Action: Credit Points
    • Label: Credit Qualifying Points to Member
    • Program: LevelUp
    • Currency Type: Tier Points
    • Recipient Member ID: {!InputTransactionJournal.MemberId}
    • Number of Points to Credit: {!InputTransactionJournal.TransactionAmount}
    • Journal ID: {!InputTransactionJournal.Id}
  2. Click Done.

The New Action window where you enter values required to credit points.

We must now connect all the elements using connectors to build the flow. This determines the order in which the flow is executed at run time.

  1. To connect the elements, click and drag connectors (round buttons inside each element) from one element to another. Connect the elements in the following sequence: Start > Credit Non-Qualifying Points Based on Order Amount (Action) > Get LevelX Promotion (Get Records) > Get Matching Promotion Product Records (Get Records) > Does Promotion Apply On Transaction (Decision) > Credit Points for Promotion (Action) > Credit Qualifying Points to Member (Action). When connecting the Decision and Action elements, select the outcome for the decision connector as Yes.
  2. Click Save.

    The Flow Builder page where you add the required elements and connect them in a logical and sequential order.
  3. Click Save.
  4. Enter the flow name: Credit Member Points and Promotion
  5. Click Activate.

When this flow runs, it automatically credits members qualifying and non-qualifying points for their purchases. It also checks if the member is eligible for a promotion and credits them with 100 points where applicable. 

Modify an Accrual Flow

Mary is amazed at the convenience that flows bring to the table. She thinks about other program requirements that may require automation.

The requirements of the LevelUp loyalty program included a joining bonus and a discount voucher for new members. Mary planned to give new members a bonus of 200 points and a 15% discount voucher, valid for a month from the date of enrollment. She recalls having a similar requirement for Cloud Kicks’s loyalty program, Inner Circle. She works with Jose to add the same requirement to the LevelUp loyalty program. 

Jose looks for the flow that was used in the Inner Circle loyalty program. To reuse the flow, he must clone it. Note that this is a different flow and not the one Jose created earlier.

Here's what he does. 

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. Find and select the Enrollment Bonus for New Inner Circle Members flow.
  4. Click Save As.
  5. Click A New Flow.
  6. In Flow Label, enter Enrollment Bonus for New LevelUp Members.
  7. Click Save.

Jose now uses this flow as a template and modifies it to run for the LevelUp loyalty program. There are a few changes he makes.

  1. In the Start element, click Edit beside Object: Loyalty Program Member.

    The Start element page where you define when the flow should run.
    To make this flow compatible with the LevelUp program, he has to enter the LevelUp loyalty program ID. You will find the program ID in the URL of the main LevelUp loyalty program record page.

    The LevelUp home page where you can select the program ID from the URL.
  2. In the Value field for ProgramId, enter the ID. Jose enters 0lpB00000004DsjIAE.
  3. Click Done.

    The Choose Object window where you select the fields from which the loyalty program member details should be pulled.
  4. Click the Credit Enrollment Bonus Action element twice to edit it.
  5. Provide the following details.
    • Program: LevelUp
    • Currency: Member Points
  6. Click Done.

    The Edit Credit Points core action window where you can enter details of the LevelUp loyalty program.
  7. Click the Issue Voucher to New Member Action element twice to edit it.
  8. Provide the following details.
    • Program Name: LevelUp
    • Voucher Definition Name: 15% discount on purchases
  9. Click Done.

    The Edit Issue Voucher core action window where you can enter details of the LevelUp loyalty program.
  10. Click Save.
  11. Click Activate.

This flow automatically triggers a credit action when a new member enrolls. As soon as a new Loyalty Program Member record is saved, the flow gets triggered. For this flow to work, a transaction journal for member enrollment is created with Journal Type as Accrual (because the member will be accruing points), and Journal SubType as Enrollment Bonus (which Jose had already created in the org). The flow also checks the enrollment date and member ID. Details from this transaction journal are then used to credit 200 bonus points. After the points are credited, the 15% discount voucher is issued.

The Flow Builder page where you can create flows for accrual processes.

Mary can’t wait to see the automation in action when members start enrolling in the program.

Resources 

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities