Skip to main content

Create a Flow and Run the Redemption

Follow Along with Trail Together

Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series.

(This clip starts at the 34:15 minute mark, in case you want to rewind and watch the beginning of the step again.)

Create Rules in Flow

Linda must create a flow that checks if a redemption rule exists for the product or voucher, and whether the member has enough points to redeem the rewards. If they have sufficient balance, the flow debits points. 

She creates a record-triggered flow because redemptions happen in real time. So the flow should run when a transaction journal is created. 

  1. Click Setup , and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. Click New Flow.
  4. Make sure Start from Scratch is selected, and click Next.
  5. Select Record-Triggered Flow.
  6. Click Create and provide the following details.
    • Object: Transaction Journal 
    • Configure Trigger: A record is created 
    • Condition Requirements: All Conditions are Met (AND) 
    • Field: Status 
    • Operator: Equals 
    • Value: Pending 
    • Optimize this flow for: Actions and Related Records 
  7. Click Close to close the panel.

The Configure Start panel where you define the conditions for the flow.

Note

In this project, we are creating a record-triggered flow. Typically, a redemption API is created, which then creates the transaction journal and executes the flow. This API is called from the redemption portal when the member chooses the product to redeem. 

Linda must now add several Decision and Action elements to the flow. Let’s follow along.

Add a Decision Element

Linda uses a Decision element to filter all the transaction journals related to the Inner Circle loyalty program, with the journal type as Redemption. 

  1. On the path after the Start element, click Add Element. Select the Decision element.
    • Label: Check Entry Conditions
  2. In the Outcome Details, enter the following details.
    • Label: Entry Conditions
    • Condition Requirements to Execute Outcome: All Conditions are Met (AND) 
    • Resource: select Triggering TransactionJournal, then select Loyalty Program ID (the one with > at the end of the line), then select Program Name
    • Operator: Equals 
    • Value: Cloud Kicks Inner Circle
  3. Click Add Condition and enter the following details.
    • Resource: select Triggering TransactionJournal, then select Journal Type ID (the one with > at the end of the line), then select Name
    • Operator: Equals
    • Value: Redemption

The New Decision window where you define the parameters to filter the transactions.

Add a Redemption Catalog Action

Next, Linda adds an Action element that uses the decision table.

  1. On the Entry Conditions path, click Add Element. Select the Action element.
    • Click the Decision Table category
    • Select the Redemption Catalog for Inner Circle - TransactionJournalLink action
  2. Enter the following details.
    • Label: Get Redemption Quote
    • Transaction Journal: select Triggering TransactionJournal, then click outside the field

The New Action window where you use the decision table.

Add a Second Decision

Linda uses the Decision element to check the outcome of the decision table. 

  1. On the Entry Conditions path after the Get Redemption Quote element, click Add Element. Select the Decision element.
    • Label: Decision Table Outcome
  2. In the Outcome Details, enter the following details.
    • Label: Outcome
    • Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    • Resource: select Outputs from Get Redemption Quote, then select Single Outcome, then click outside the field
    • Operator: Is Null
    • Value: False

The New Decision window where you define the parameters to check the outcome of the decision table.

Add a Get Points Balance Action

To get details of members’ points, Linda uses the Get Points Balance action. 

  1. On the Outcome path, click Add Element. Select the Action element.
    • Click the Loyalty category
    • Select the Get Points Balance action
  2. Enter the following details.
    • Label: Get Member Balance
    • Program: Cloud Kicks Inner Circle
    • Currency Type: Regular Points
    • Member ID: select $Record then select MemberId

The New Action window for the Get Points Balance action.

Add a Third Decision

Linda then uses a Decision element that evaluates if the member’s points balance is sufficient for redemption. 

  1. On the Outcomes path after the Get Member Balance element, click Add Element. Select the Decision element.
    • Label: Check Sufficient Balance
  2. In the Outcome Details, enter the following details.
    • Label: Sufficient Balance
    • Condition Requirements to Execute Outcome: All Conditions Are Met (AND) 
    • Resource: select Outputs from Get Member Balance, then select PointsBalance
    • Operator: Greater Than or Equal 
    • Value: select Outputs from Get Redemption Quote, then select Single Outcome, then select Points

The New Decision window where you define the parameters to check the member’s points balance.

Add a Debit Points Action

Linda uses a Debit Points action to debit the required points based on the rules.

  1. On the Sufficient Balance path, click Add Element. Select the Action element.
    • Click the Loyalty category
    • Select the Debit Points action
  2. Enter the following details.
    • Label: Debit Points for Member
    • Program: Cloud Kicks Inner Circle 
    • Currency Type: Regular Points 
    • Recipient Member ID: select $Record then select MemberId
    • Number of Points to Debit: select Outputs from Get_Redemption_Quote, then select singleOutcome, then select Points__c
    • Journal ID: select $Record then select Id

The New Action window for the Debit Points action.

Add a Fourth Decision

Linda uses a Decision element to check if the voucher needs to be issued to the member.

  1. On the Sufficient Balance path after the Debit Points for Member element, click Add Element. Select the Decision element.
    • Label: Check If Voucher Needs to be Issued
  2. In the Outcome Details, enter the following details.
    • Label: Voucher Needs to be Issued
    • Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    • Resource: select Outputs from Get Redemption Quote, then select Single Outcome, then select Voucher Definition
    • Operator: Is Null
    • Value: False

The New Decision window where you define the parameters to check if a voucher needs to be issued.

Add an Issue Voucher Action

Lastly, Linda uses the Issue Voucher loyalty action to issue the voucher based on the redemption catalog.

  1. On the Voucher Needs to be Issued path, click Add Element. Select the Action element.
    • Click the Loyalty category
    • Select the Issue Voucher action
  2. Enter the following details.
    • Label: Issue Voucher to Member
    • Member ID: select $Record then select MemberId
    • Program Name: Cloud Kicks Inner Circle
    • Journal ID: select $Record then select Id
    • Voucher Definition Name: select Outputs from Get_Redemption_Quote, then select singleOutcome, then select Voucher_Definition__r, then select Name

The New Action window for the Issue Voucher loyalty action.

Save the Flow

Having created all the elements, Linda saves and activates the flow.

  1. In the button bar, click Save.
  2. Enter the Flow Label: Redemption Flow for Inner Circle
  3. Click Save.
  4. Click Activate.
    The Flow Builder canvas showing all the created flow elements.

When the flow is executed, the points are redeemed and the corresponding records in the Loyalty Member Currency table are updated, including the points balance and total points redeemed.

Run Redemption Processing

Let’s look at how the points are debited and updated when a transaction is processed. 

Adria Darby, an Inner Circle loyalty member, wants to redeem a $20 Cloud Kicks voucher. As soon as the transaction journal is created, Adria is debited with 1000 nonqualifying points. Linda creates a transaction journal to see this in action. 

  1. In the Loyalty Programs tab, select the Cloud Kicks Inner Circle loyalty program.
  2. In the Setup tab, under Loyalty Program Members, select CL001.
  3. On the Transaction Journals card, click New.
  4. Provide the following details.
      • Journal Type: Redemption 
      • Partner: Cloud Kicks 
      • Activity Date: Current Date
      • Journal Date: Current Date
      • Status: Pending 
      • Loyalty Program: Cloud Kicks Inner Circle 
      • Product: $20 voucher applicable on all footwear 
  1. Click Save.

The New Transaction Journal window where you can manually create a transaction journal.

As soon as the transaction is created, the transaction journal status changes to Processed, and the Loyalty Ledgers card is updated with the points. On the Vouchers card, Linda finds that the voucher has been issued. 

The Loyalty Ledgers card with the debited points, and the Vouchers card with the issued voucher.

She navigates to the Loyalty Member Currency card on the member’s record page and sees that the nonqualifying points balance has been debited with 1,000 points. 

Note

For products that don’t have vouchers, the flow processes the transaction similarly. It fetches details of the redemption points and debits the member’s points balance. For example, if a member purchases a shoe from the Johan Steven range, the flow simply deducts 5000 points from their points balance. If a member redeems their points for Custom Sneakers Consultation, the flow debits 4000 points. To create a record for the consultation, extend the flow based on the requirements.

In Conclusion

Linda has set up the redemption process using a combination of decision tables and flows, and Mary can’t thank her enough. With the process in place and customers seamlessly redeeming products and vouchers, both Cloud Kicks and NTO are mutually benefitting from the partnership. No matter how complex your loyalty program is, you can design the redemption process as per your business requirements.

Teilen Sie Ihr Trailhead-Feedback über die Salesforce-Hilfe.

Wir würden uns sehr freuen, von Ihren Erfahrungen mit Trailhead zu hören: Sie können jetzt jederzeit über die Salesforce-Hilfe auf das neue Feedback-Formular zugreifen.

Weitere Infos Weiter zu "Feedback teilen"