Loading

Salesforce Loyalty Management: creditPoints Action Creates an Expired Loyalty Ledger When ActivityDate Precedes the Reset Date

Publiceringsdatum: Jul 17, 2026
Beskrivning

Executing the creditPoints action on a Transaction Journal produces two ledger records:

  1. Credit LoyaltyLedger for the credited points.
  2. An additional LoyaltyLedger with Event Type = Expired.

The Expired ledger appears at the moment of credit even though a separate expiration process was not run.

When it happens

The Expired ledger is created when the TransactionJournal.ActivityDate is earlier than the applicable judgment date. The judgment date is chosen as follows:

  • If LoyaltyMemberCurrency.NextResetDate is a past date — NextResetDate becomes the judgment date. Condition: ActivityDate < NextResetDate ≤ today → Expired ledger created.
  • If NextResetDate is a future date or is null — LoyaltyMemberCurrency.LastResetDate is the judgment date. Condition: ActivityDate < LastResetDate → Expired ledger created.

The Expired ledger itself is written with its ActivityDate set to the LastResetDate used at judgment.

Impact on point balance

When the Expired ledger is created by creditPoints:

  • TotalPointsExpired on the Loyalty Member Currency increases.
  • PointsBalance on the Loyalty Member Currency decreases.
  • BalanceBeforeReset is updated because the write-back sets shouldUpdateBalanceBeforeReset(true).

The reduction in PointsBalance reflects points that should already have expired at the reset date, not new points being destroyed by creditPoints. In other words, the balance is corrected to its expected post-reset value; creditPoints does not consume newly credited points.

Rank/tier evaluation and other downstream logic consume the standard fields (PointsBalanceTotalPointsExpired), so no custom implementation is required for the reduction to propagate.

Purpose

The behavior exists to prevent points that were due to be reset on NextResetDate (or points earned before the previous LastResetDate) from being carried, even temporarily, when new points are credited with a back-dated ActivityDate.

 

 

Lösning

The Expired ledger creation is intended standard behavior and cannot be disabled through any supported configuration or setting. Use the following steps to confirm if the temporary expiration at credit time is not desired, adjust ActivityDate or reset-date timing.

1. Confirm the affected records

  1. Open the affected LoyaltyMemberCurrency record and record the values of NextResetDate and LastResetDate.
  2. Open the TransactionJournal used by the creditPoints action and record the ActivityDate.
  3. Compare against the two conditions:
    • NextResetDate is a past date and ActivityDate < NextResetDate → Expired ledger is expected.
    • NextResetDate is future or null and ActivityDate < LastResetDate → Expired ledger is expected.

2. Align ActivityDate with the reset date (if the Expired ledger is not desired)

  • Set the Transaction Journal's ActivityDate to on or after the applicable judgment date:
    • If NextResetDate is in the past → set ActivityDate ≥ NextResetDate (or later than the current date, as appropriate).
    • If NextResetDate is future or null → set ActivityDate ≥ LastResetDate.
  • Alternatively, adjust the reset-date configuration on the Loyalty Program Currency so that the reset schedule aligns with the accrual dates the business generates.

3. Verify the balance change

Confirm the actual net movement of PointsBalance and TotalPointsExpired on a live test:

SELECT Id, LoyaltyProgramMemberId, PointsBalance, TotalPointsExpired,
BalanceBeforeReset, NextResetDate, LastResetDate
FROM LoyaltyMemberCurrency
WHERE LoyaltyProgramMemberId = '<test member Id>'

Compare values before and after running creditPoints with a back-dated ActivityDate on a test member.

4. Verification

Re-run the flow containing the creditPoints action for a test member with a TransactionJournal.ActivityDate on or after the applicable reset date. Confirm that:

  • No LoyaltyLedger with Event Type = Expired is created.
  • PointsBalance reflects the credited points as expected and TotalPointsExpired is unchanged.

Then repeat with ActivityDate set earlier than the applicable reset date and confirm the Expired ledger appears, TotalPointsExpired increases, and PointsBalance decreases by the same amount.

Knowledge-artikelnummer

005389133

 
Laddar
Salesforce Help | Article