Skip to main content

Process Transaction Journals

Activate the Flow

In a real-world scenario, the Loyalty Program Process Connect API processes transactions as soon as members make a transaction. The Connect API can be integrated with apps that generate transactions for a sale or service, for example, Point of Sale (POS) systems.

In this project, Mary processes the transactions using a loyalty flow action called Run Program Process for Transaction Journal. This flow action is used in the Run Loyalty Program Process flow, which is already created for you. Mary navigates to the flow to activate it. 

Note

For the loyalty program process and challenges to run, you must activate this flow in the special Developer Edition org you’re using.

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. Find and select the Run Loyalty Program Process flow.
  4. Click Activate.

The Flow Builder page where you activate the flow.

Simulate a Transaction Journal

Mary decides to use simulation to check how the loyalty program process executes pending or processed transaction journals. The loyalty program process runs the journal whose type and subtype match that of the process.

  1. Click App Launcher, and select Loyalty Management.
  2. In the Program Name column, click Cloud Kicks Inner Circle.
  3. In the Cloud Kicks Inner Circle program record, click the Members And Partners tab.
  4. In the Loyalty Program Members related list, select CL001.
  5. On the Transaction Journals related list, click 00000001.
  6. In the Loyalty Program Process component, click Simulate.

After the simulation completes, Mary clicks each rule to view how it processed the transaction journal.

The Loyalty Program Process card showing the results of a simulation

The transaction she selected met the first two rules of the accrual process, but not the third rule. So Mary creates a transaction to see how the points are credited and updated when it’s associated with a promotion and meets the attribute target. 

Create a Transaction Journal

Adria Darby, a Cloud Kicks Inner Circle member, purchases a pair of Cloud Kicks shoes for $600. When the transaction journal processes, she’s credited with 600 Tier Points and Regular Points each. As Adria qualifies for the promotion, she also gets Regular Points twice that of the transaction amount, which amounts to 1200 Regular Points. Lastly, because she’s met the target of $500, she receives a $10 voucher. 

Mary creates a transaction journal to record Adria’s purchase.

  1. Click App Launcher, and select Loyalty Management.
  2. In the Program Name column, click Cloud Kicks Inner Circle.
  3. In the Cloud Kicks Inner Circle program record, click the Members And Partners tab.
  4. In the Loyalty Program Members related list, select CL001.
  5. On the Transaction Journals related list, click New.
  6. Add the following details.
    • Journal Type: Accrual
    • Journal Subtype: Purchase
    • Partner: Cloud Kicks
    • Activity Date: Current date
    • Journal Date: Current date
    • Status: Pending
    • Loyalty Program: Cloud Kicks Inner Circle
    • Product: Super Kicks
    • Transaction Amount: 600
  1. Click Save.

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

As soon as the transaction journal is created, its status changes to ‘Processed’, and the Loyalty Ledgers card is updated with the points. On the Vouchers card, Mary finds that the voucher is issued. The balances for Regular Points and Tier Points are also updated. 

The Loyalty Ledgers and Vouchers cards with the credited points and issued voucher.

Each time the process runs, it updates Adria’s progress for an engagement attribute. Next, Mary tracks her progress during the lifespan of an engagement attribute.

Track Members’ Progress for Engagement Attributes

A Loyalty Program Member Attribute Value record is created when a member’s progress in achieving the engagement attribute target is updated for the first time during a period. If a member’s progress is tracked across periods, then one Loyalty Program Member Attribute Value record tracks the member's progress across the lifecycle of the attribute. If the member’s progress is uniquely tracked for each period, then Loyalty Program Member Attribute Value records are created for each period. 

Mary views the attribute values in the Loyalty Program Member Attribute Values card of the loyalty program member record. Here’s a look at Adria Darby’s attribute values. 

  • Current Value indicates the value Adria achieved since the last reset. The value resets to 0 after she achieves the target in the period.
  • Cumulative Value indicates the value she achieved throughout the period (or the month in this case).
  • Target Value indicates the value that Adria must achieve to qualify for the Spend $500, Get a Voucher promotion.

The Loyalty Program Member Attribute Values card where you can track the progress for an engagement attribute

Mary wants to create a second accrual process for engagement activities. 

Review the Process for Engagement Activity

Mary follows the instructions shown in Step 2: Create a Process for Purchases to create a process called Credit Points for Activities. She selects Accrual as the journal type and Social Media Activity as the journal subtype. She creates a rule within this process, comprising two Credit Points actions to credit members with Regular Points and Tier Points. 

Note

The process and the rule have already been created for you and are active. To review the process, navigate to the Loyalty Program Process record page and select Credit Points for Activities.

The Credit Points for Activities Loyalty Program Process page.

Create a Batch Job

If you recall the rules defined in Step 1, transaction journals related to engagement activities are loaded into Loyalty Management every night. So this process must be executed in batch mode. Mary creates a Batch Management job that processes transaction journals by using the applicable loyalty program process as soon as transactions are loaded. 

  1. Click Setup, and select Setup.
  2. Enter Batch in the Quick Find box, and select Batch Management.
  3. Click New and add the following details.
    • Name: Accrual Batch
    • Process Type: Loyalty Program Process
    • Execution Process: Transaction Journals
    • Group: Loyalty
    • Batch Size: 200
    • Retry Count: 1
    • Retry Interval: 1000
  1. Click Next and add the following details.
    • Object: Transaction Journal 
    • Select Records When: All Conditions Are Met (AND)
    • Resource: Status
    • Operator: Equals
    • Type: Value
    • Value: Pending
    • Click Add Condition and add the following details.

      Resource

      Operator

      Type

      Value

      Journal Type ID

      Equals

      Value

      Accrual

      Journal SubType ID

      Equals

      Value

      Social Media Activity

  1. Click Save.The New batch job page where you add the conditions for a job
  2. Click Activate.
Note

The Loyalty Program Process type automatically processes transaction journals using the Loyalty Program Process record whose journal type and subtype match the transaction journal record.

Mary schedules this batch job to run using a flow.

Create a Flow to Schedule the Batch Job

  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 Schedule-Triggered Flow.
  6. Click Create.
  7. On the Start element, click Set Schedule and add the following details.
    • Start Date: Current date
    • Start Time: 12:00 AM
    • Frequency: Daily
  1. Hover over Add Element and click Add Element. Select the Action element.
  2. Add the following details.
    • Search actions: Accrual_Batch
    • Label: Accrual Batch
    • API Name: Accrual_Batch

The New Action window where you create a new action for a flow

  1. Click Save.
  2. Enter the Flow Label: Run Batch Job for Accruals
  3. Click Save.
  4. Click Activate.

The Flow Builder page where you activate the flow

This flow runs the batch job daily, at the scheduled time. Let’s look at how the points are credited and updated when a transaction for social media activity is processed. 

Create a Transaction Journal for Social Media Posts

Adria Darby is excited after her recent purchase of Cloud Kicks sneakers. She posts a review about the product on her social media account. Based on the rules Mary set up, Adria is credited with 50 Regular Points and 10 Tier Points. Mary 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 Cloud Kicks Inner Circle program record, click the Members And Partners tab.
  3. In the Loyalty Program Members related list, select CL001.
  4. On the Transaction Journals related list, click New.
  5. Add the following details.
    • Journal Type: Accrual
    • Journal Subtype: Social Media Activity
    • Activity Date: Current date
    • Journal Date: Current date
    • Status: Pending
    • Loyalty Program: Cloud Kicks Inner Circle
  1. Click Save.

The New Transaction Journal window where you manually create a transaction journal for social media engagement

The transaction journal is saved in the pending state because it’s not processed yet. When the batch job runs as per the schedule, it will process this transaction. Mary, however, wants to test the process to see if it’s working fine. 

Run the Flow

Mary runs the Run Batch Job for Accruals flow to process the transaction. 

  1. Click Setup, and select Setup.
  2. Enter Flows in the Quick Find box, and select Flows.
  3. From the Flows list view, select Run Batch Job for Accruals.
  4. Click Debug.
  5. Deselect Debug pause element behavior.
  6. Click Run.

The flow triggers the Accrual Batch job. Mary monitors the status of the run on the Monitor Workflow Services page. 

The Monitor Workflow Services page where you view the status of a batch job

After the status of the run changes to Completed, the transaction is processed and the Loyalty Ledgers card is updated with the points. If you don’t see the updated ledgers, refresh the page and check again. 

The Loyalty Ledgers card showing the points for social media activity

The member’s points are updated as soon as the transaction is processed. Mary is happy with the two accrual processes she has set up. 

Conclusion

The promotions have led to a huge spike in the sale of Super Kicks, and the product is almost sold out. Members are happy with the rewards they’ve earned and are taking to social media to post about their experiences. 

Mary is pleased with how easily she was able to set up the accrual process. She can continue adding rules to the existing processes or create new processes for different journal types and subtypes. Using Promotion Setup, she can customize the processes to her business requirements. She can also create engagement attributes that track the long-term behavior of members, and reward them for achieving the attribute’s target.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈