Create Partner Ledgers and Update Partner Balances Definition

The Create Partner Ledgers and Update Partner Balances Data Processing Engine definition template creates partner ledgers and updates partner balances based on the processed partner transactions.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions with Loyalty Management - Growth or Loyalty Management - Advanced

The definition aggregates and updates partner balances for processed partner transactions for the prepaid or postpaid billing types. For the first run, the definition considers all existing processed partner transactions. The subsequent runs consider only the processed transaction journals that are created after the previous run. These transaction journal types are included in the definition:

  • Accrual
  • Redemption
  • Accrual Reversal
  • Redemption Reversal

Input Variables

The Data Processing Engine definition is run based on these input variables:After the processing, the definition output includes:

  • Loyalty Program Name: The loyalty program for which the definition is run. This variable considers partner transactions that belong to the specified loyalty program.
  • Run Date and Time: The date and time when the job processes the partner transactions. This variable filters Loyalty Ledger records that are created between the previous run and the current run. The definition updates the Last Processed Date and Time field on the Loyalty Program Partner record.
    Note
    Note In a flow, use $Flow.InterviewStartTime as the value for the Run Date and Time input variable. The flow interview start time is the date and time when the flow is run. Salesforce recommends not using dates from the future or the past to ensure that the subsequent runs don’t miss processing any ledgers.

After the processing, the definition output includes:

  • Loyalty Program Partner Ledgers
  • Loyalty Program Partner

The definition creates unique ledger records for each partner based on the processed transaction journal types and the transaction date. For prepaid billing, when points are deducted from multiple packs, unique ledger records are created. But each ledger deducts points from one pack. Partner balances are calculated only after processing the transactions and associating the ledgers.

If you run the definition daily to process all the four types of transactions, then seven ledgers are created.

The transaction amount and the accrual conversion factor determine the number of points that are used by the associated partner for the transaction. The transaction amount and the redemption conversion factor determine the number of points to add to the associated partner’s credited points.

Example
Example The definition processes transactions for a partner with one pack that members can use to accrue and redeem points. Multiple transactions are reversed daily for both redemptions and accruals. The definition runs daily. Here’s the breakdown of the ledgers created daily for the partner:
Ledger Type What it Does
Debit Calculates points to debit from the partner’s points balance and to add to the debited points for the Accrual type partner transactions.
Debit Cancellation Calculates and adds points to the partner’s credited points for the Accrual Reversal type partner transactions.
Credit Calculates points to add to the partner’s credited points for the Accrual Reversal type partner transactions.
Credit Cancellation Calculates points to remove from the partner’s credited points for the Redemption Reversal type partner transactions.

Partner Balances

After the ledgers are created for a partner, based on the value of the ledgers and the ledger type, the various balances, such as points balance, debited points, and credited points, of the partner that uses prepaid billing are updated. For the partner that uses postpaid billing, the postpaid bill amount is updated. The criteria for the definition includes transaction journals of these attributes:

  • An associated loyalty program
  • An associated loyalty program partner
  • A billing type—prepaid or postpaid
  • A transaction journal type—Accrual, Redemption, Accrual Reversal, or Redemption Reversal
  • A specified transaction amount
    Note
    Note The transaction amount and the accrual conversion factor determine the points that are used by the associated partner for the transaction. The transaction amount and the redemption conversion factor determine the points to add to the associated partner’s credited points.

Run the Definition

Review the Create Partner Ledgers and Update Partner Balance Data Processing Engine definition, copy and customize the definition to your requirements, and then activate the definition.

Run the definition in a flow and ensure that the definition processes Transaction Journal records that are in the Processed status. For prepaid billing or postpaid billing, partner balances are calculated only after the transactions are processed and the ledgers are associated with the transactions.

Note
Note You can add the definition at the end of a flow that processes transaction journals and credits or debits points to members.