Transaction Journals Simulation

Runs a simulation to determine how transaction journals are processed against their corresponding loyalty program processes. When transaction journals meet the criteria and conditions for a program process, actions that are set up in the process are triggered for the transaction journals.

Special Access Rules 

To use this resource, your org must have either B2C - Loyalty, B2C - Loyalty Plus, Loyalty Management - Growth, or Loyalty Management - Advanced license enabled, and you must be assigned the Loyalty Management permission set.

Resource 

1/connect/realtime/loyalty/programs/${programName}

Resource Example 

1https://YOUR_INSTANCE.SALESFORCE.COM/services/data/vXX.X
2/connect/realtime/loyalty/programs/StarAir_Program

Available Version 

55.0

Requires Chatter 

No

HTTP Methods 

POST

Request Body for POST 

Root XML Tag

<loyaltyEngineInput>

JSON Example

Some of the API request fields contain field names that are interchangeable. For information on the list of interchangeable field names, see Loyalty Management Connect API Interchangeable Request Fields.

Note

Here’s a sample request to pass loyalty engine runtime details.

To enforce promotion limits, include the appliedPromotions array inside each transaction journal entry in the request. Promotion limits are not evaluated if this array is absent. Use the Eligible Promotions List (POST) resource to retrieve the list of promotions that haven’t reached their limit, and pass the result as appliedPromotions. For coupon-based promotions with usage limits, also set shouldCheckCouponUsageLimit to true at the top level of the request.

Note

1{
2  "shouldCheckCouponUsageLimit": true,
3  "transactionJournals": [
4    {
5      "ActivityDate": "2022-01-04T12:45:19Z",
6      "JournalDate": "2022-01-04T00:45:19Z",
7      "Brand": "",
8      "Establishment": "Apple",
9      "ExternalTransactionNumber": "P1-981950",
10      "JournalTypeId": "0lET10000004CQp",
11      "LoyaltyProgramId": "0lpT10000004CdN",
12      "MemberId": "0lMT10000004CfA",
13      "TransactionAmount": "117",
14      "TransactionLocation": "HitechCity",
15      "VoucherCode": "",
16      "Origin": "asdf",
17      "Distance": "5",
18      "Destination": "Hyderabad",
19      "FlightNumber": "SF-Ran-001",
20      "Status": "Pending"
21    }
22  ],
23  "runSetting": {
24    "isSimulation": true
25  }
26}

Provide contactId to retrieve rewards related to a Person Account.

Note

Using the transaction journal ID:

1{
2  "transactionJournals": [
3    {
4      "Id": "0lVxx00000000cj"
5    }
6  ],
7  "runSetting": {
8    "isSimulation": true
9  }
10}

Sample payload to retrieve rewards assigned to accounts.

1{
2    "transactionJournals": [
3      {
4        "ActivityDate": "2024-11-27T12:45:19Z",
5        "JournalTypeId": "0lERM00000001Bb2AI",
6        "LoyaltyProgramId": "0lpRM00000002YTYAY",
7        "ReferredPartyId": "001xx000003H3NnAAK",
8        "Status": "Pending",
9        "ProductId": "01txx0000006i44AAA",
10        "ProductCategoryId": "0ZGxx0000000001GAA",
11        "Quantity": "1",
12        "TransactionAmount": "42",
13        "appliedPromotions": [
14          {
15            "promotionId": "0c8xx00000000mPAAQ",
16            "rewards": [
17              {
18                "rewardType": "Discount",
19                "discountAmount": 5
20              },
21              {
22                "rewardType": "Discount",
23                "discountAmount": 10
24              },
25              {
26                "rewardType": "Voucher",
27                "voucherDefinitionName": "Voucher2",
28                "voucherExpirationDate": "2025-08-07",
29                "voucherEffectiveDate": "2024-08-08",
30              },
31              {
32                "rewardType": "Game",
33                "gameDefinitionName": "TestPostFacto",
34              },
35            ]
36          }
37        ] 
38      }
39    ]
40  }

Properties

NameTypeDescriptionRequired or OptionalAvailable Version
shouldCheckCouponUsageLimitBooleanIndicates whether the coupon usage limit check is enabled.Required62.0
transactionJournalsLoyalty Engine Input MapRepresents the transaction journals records to process.Required54.0
runSettingLoyalty Engine Run Settings InputLoyalty runtime setting to run the simulation on the transaction journals.Required for simulation, otherwise optional55.0

Response Body for POST 

Loyalty Engine Realtime Output

JSON Example 

1{
2  "message": null,
3  "processResult": null,
4  "programName": "StarAir_Program",
5  "simulationResults": {
6    "transactionJournals": [
7      {
8        "executionSummary": {
9          "pointsSummary": [
10            {
11              "changeInEscrowPointsBalance": 0,
12              "changeInPointsBalance": 250,
13              "loyaltyProgramCurrencyName": "VroomKing",
14              "loyaltyProgramCurrencyType": "NonQualifying"
15            },
16            {
17              "changeInEscrowPointsBalance": 20,
18              "changeInPointsBalance": 0,
19              "loyaltyProgramCurrencyName": "EcoMiles",
20              "loyaltyProgramCurrencyType": "Qualifying"
21            }
22          ],
23          "vouchersIssuedCount": 0
24        },
25        "processId": "9MXxx0000004Khg",
26        "processName": "Redemption Process",
27        "processRules": [
28          {
29            "actionResultSummary": [
30              {
31                "actionType": "CreditPoints",
32                "changeInEscrowPointsBalance": 20,
33                "changeInPointsBalance": 0,
34                "escrowPointsCreditDate": "2022-03-05T00:00:00.000Z",
35                "loyaltyProgramCurrencyName": "EcoMiles",
36                "promotionId": "",
37                "stepName": "Credit Brownie Points"
38              },
39              {
40                "actionType": "CreditPoints",
41                "changeInEscrowPointsBalance": 0,
42                "changeInPointsBalance": 250,
43                "loyaltyProgramCurrencyName": "VroomKing",
44                "promotionId": "",
45                "stepName": "Credit Base Points For Transaction"
46              }
47            ],
48            "executionStatus": "Success",
49            "executionSummary": {
50              "pointsSummary": [
51                {
52                  "changeInEscrowPointsBalance": 0,
53                  "changeInPointsBalance": 250,
54                  "loyaltyProgramCurrencyName": "VroomKing",
55                  "loyaltyProgramCurrencyType": "NonQualifying"
56                },
57                {
58                  "changeInEscrowPointsBalance": 20,
59                  "changeInPointsBalance": 0,
60                  "loyaltyProgramCurrencyName": "EcoMiles",
61                  "loyaltyProgramCurrencyType": "Qualifying"
62                }
63              ],
64              "vouchersIssuedCount": 0
65            },
66            "processRuleName": "Rule 1",
67            "ruleSteps": [
68              {
69                "childSteps": [
70                  {
71                    "actionParameters": [
72                      {
73                        "name": "Notes",
74                        "operator": "Equals",
75                        "value": {
76                          "expression": "Credit Brownie Points",
77                          "expressionValue": {
78                            "dataType": "Text",
79                            "value": "Credit Brownie Points"
80                          },
81                          "parameterValues": {}
82                        }
83                      },
84                      {
85                        "name": "ProgramCurrencyName",
86                        "operator": "Equals",
87                        "value": {
88                          "expression": "EcoMiles",
89                          "expressionValue": {
90                            "dataType": "Text",
91                            "value": "EcoMiles"
92                          },
93                          "parameterValues": {}
94                        }
95                      },
96                      {
97                        "name": "PointsToCredit",
98                        "operator": "Equals",
99                        "value": {
100                          "expression": "20",
101                          "expressionValue": {
102                            "dataType": "Number",
103                            "value": 20
104                          },
105                          "parameterValues": {}
106                        }
107                      }
108                    ],
109                    "actionType": "CreditPoints",
110                    "sequenceNumber": 1,
111                    "status": "Success",
112                    "stepName": "Credit Brownie Points",
113                    "stepType": "Action"
114                  }
115                ],
116                "filterCondition": "1",
117                "filterCriteria": [
118                  {
119                    "filterCriteriaResult": true,
120                    "operator": "Equals",
121                    "sequence": 1,
122                    "sourceFieldName": {
123                      "expression": "{!TransactionJournal.Product.Name}",
124                      "parameterValues": {
125                        "TransactionJournal.Product.Name": {
126                          "dataType": "Text",
127                          "value": "Brownie"
128                        }
129                      }
130                    },
131                    "value": {
132                      "expression": "Brownie",
133                      "expressionValue": {
134                        "dataType": "Text",
135                        "value": "Brownie"
136                      },
137                      "parameterValues": {}
138                    },
139                    "valueType": "FixedValue"
140                  }
141                ],
142                "isConditionMet": true,
143                "sequenceNumber": 1,
144                "status": "Success",
145                "stepName": "Check Member Tier",
146                "stepType": "Condition"
147              },
148              {
149                "actionParameters": [
150                  {
151                    "name": "ProgramCurrencyName",
152                    "operator": "Equals",
153                    "value": {
154                      "expression": "VroomKing",
155                      "expressionValue": {
156                        "dataType": "Text",
157                        "value": "VroomKing"
158                      },
159                      "parameterValues": {}
160                    }
161                  },
162                  {
163                    "name": "PointsToCredit",
164                    "operator": "Equals",
165                    "value": {
166                      "expression": "{!DoublePoints}",
167                      "expressionValue": {
168                        "dataType": "Number",
169                        "value": 250
170                      },
171                      "parameterValues": {
172                        "TransactionJournal.TransactionAmount": {
173                          "dataType": "Number",
174                          "value": 125
175                        }
176                      },
177                      "resolvedExpression": "({!TransactionJournal.TransactionAmount} * 2)"
178                    }
179                  },
180                  {
181                    "name": "Notes",
182                    "operator": "Equals",
183                    "value": {
184                      "expression": "Base Points For Transaction",
185                      "expressionValue": {
186                        "dataType": "Text",
187                        "value": "Base Points For Transaction"
188                      },
189                      "parameterValues": {}
190                    }
191                  }
192                ],
193                "actionType": "CreditPoints",
194                "sequenceNumber": 2,
195                "status": "Success",
196                "stepName": "Credit Base Points For Transaction",
197                "stepType": "Action"
198              }
199            ]
200          },
201          {
202            "actionResultSummary": [],
203            "errorMessage": "This rule didn’t process the transaction journal because the activity date of the transaction journal isn’t between the start date and the end date of the Holiday Season Promotion promotion.",
204            "executionStatus": "Failed",
205            "executionSummary": {
206              "pointsSummary": [],
207              "vouchersIssuedCount": 0
208            },
209            "processRuleName": "Rule 2",
210            "promotionName": "Holiday Season Promotion",
211            "ruleSteps": [
212              {
213                "actionParameters": [
214                  {
215                    "name": "VoucherExpirationDate",
216                    "operator": "Equals",
217                    "value": {
218                      "expression": "DATEVALUE(&quot;2023-01-31 00:00:00&quot;)",
219                      "expressionValue": {
220                        "dataType": "Date",
221                        "value": "DATEVALUE(&quot;2023-01-31 00:00:00&quot;)"
222                      },
223                      "parameterValues": {}
224                    }
225                  },
226                  {
227                    "name": "VoucherDiscountPercentage",
228                    "operator": "Equals",
229                    "value": {
230                      "expression": "10",
231                      "expressionValue": {
232                        "dataType": "Number",
233                        "value": "10"
234                      },
235                      "parameterValues": {}
236                    }
237                  },
238                  {
239                    "name": "VoucherCode",
240                    "operator": "Equals",
241                    "value": {
242                      "expression": "&quot;QWDBHYWIGFOIHW&quot;",
243                      "expressionValue": {
244                        "dataType": "Text",
245                        "value": "&quot;QWDBHYWIGFOIHW&quot;"
246                      },
247                      "parameterValues": {}
248                    }
249                  },
250                  {
251                    "name": "VoucherEffectiveDate",
252                    "operator": "Equals",
253                    "value": {
254                      "expression": "DATEVALUE(&quot;2022-12-24 00:00:00&quot;)",
255                      "expressionValue": {
256                        "dataType": "Date",
257                        "value": "DATEVALUE(&quot;2022-12-24 00:00:00&quot;)"
258                      },
259                      "parameterValues": {}
260                    }
261                  },
262                  {
263                    "name": "Notes",
264                    "operator": "Equals",
265                    "value": {
266                      "expression": "Holiday Season Voucher",
267                      "expressionValue": {
268                        "dataType": "Text",
269                        "value": "Holiday Season Voucher"
270                      },
271                      "parameterValues": {}
272                    }
273                  },
274                  {
275                    "name": "VoucherDefinitionName",
276                    "operator": "Equals",
277                    "value": {
278                      "expression": "TimeBasedVoucherDef",
279                      "expressionValue": {
280                        "dataType": "Text",
281                        "value": "TimeBasedVoucherDef"
282                      },
283                      "parameterValues": {}
284                    }
285                  }
286                ],
287                "actionType": "IssueVoucher",
288                "errorMessage": "",
289                "sequenceNumber": 1,
290                "status": "CriteriaNotMet",
291                "stepName": "Issue Holiday Season Voucher",
292                "stepType": "Action"
293              }
294            ]
295          }
296        ]
297      }
298    ]
299  },
300  "status": true
301}