Points Expiration Custom Parameters
To aid in high-volume implementations, there are some parameters that you as an admin can configure in order for the Partial Expiration batch job to remain within Salesforce governor limits when the number of Point records in the database grows very large.
Available Parameters
These parameters, used by the Partial Expiration batch job, can be found in a custom setting called Point Expiration Settings (api name: FieloPLT__PointExpirationSettings__c). To manage them, go to Setup > Custom Settings > Point Expiration Settings.
Parameters
| Parameter | Type | Default (Point / Member) | Used By Point Mode | Used By Member Mode | Description |
|---|---|---|---|---|---|
| ExecutionMode__c | Text(50) | "Point" | N/A | N/A | Number of times the batch will automatically be re-executed to expire points when the batch fails. Note: Available in FieloPLT V2.114.69+ |
| MaxAttempts__c | Number | 10 | X | X | Number of times the batch will automatically be re-executed to expire points when the batch fails. |
| MaxChain__c | Number | 20 | X | X | Number of times the batch will automatically be re-executed to expire all points. |
| QueryLimit__c | Number | 1000000 / 45000 | X | X | Number of Member records to get from the database to expire their point records |
| DMLLimit__c | Number | 2500 | X | Number of points the batch can expire on each chunk. If not all points are expired, the batch will try again according to the MaxChain__c parameter | |
| BatchSize__c | Number | 200 | X | X | Batch size of the batch execution. It means it will go expiring the points in chunks of 200 (default) members. It can lead to many point records to be expired (more than 200, because it will be like 200 * [Point Records] (Point Records = Number of point records the member has) |
| FromDate__c | Date | null | X | X | From Date to be used as the first date of the point records to expire |
| ReferenceDate__c | Date | TODAY | X | X | Date to replace TODAY's date. Note: Available in FieloPLT V2.114.69+ |
| MaxRange__c | Number | 200 | X | X | Number of days to get from the database starting from the FromDate__c parameter |
| SortByMember__c | Boolean | false | X | X | When true, the expiration batch will sort all the points by member. This avoids having multiple updates in the same member in one batch execution. Note: Available in FieloPLT V2.114.69+ |
Example
If you only set the parameter FromDate__c to, for example: 08/15/2022:
- The batch will try to expire the 2500 (
DMLLimit__c) points from the members that are found in the first 45000 point (QueryLimit__c) records from08/15/2022to03/03/2023(FromDate + 200) (MaxRange__c). But if that leads to updating more than 2500 rows (DMLLimit__c) the batch will continue expiring those points in the next execution. - If one or more chunks fail, the batch will try again 10 times (
MaxAttempts__c) - In order to expire all points on that given period, the batch will be automatically executed 20 times (
MaxChain__c) - The chunks try to expire up to 2500 point records (
DMLLimit__c) from of 200 members (BatchSize__c)
Enable Point Based Expiration
Use the following code to enable point based expiration. Execute the following code in Developer Console > Debug > Open Execute Anonynous Window
FieloPLT__PointExpirationSettings__c settings = FieloPLT__PointExpirationSettings__c.getOrgDefaults();
settings.BatchSize__c = 200;
settings.MaxChain__c = 20;
settings.DMLLimit__c = null;
settings.MaxRange__c = 365;
settings.ExecutionMode__c = 'Point';
settings.QueryLimit__c = 1000000;
settings.FromDate__c = null;
settings.ReferenceDate__c = null;
settings.MaxAttempts__c = 15;
settings.SortByMember__c = false;
upsert settings;Enable Member Based Expiration
Use the following code to enable member based expiration. Execute the following code in Developer Console > Debug > Open Execute Anonynous Window
FieloPLT__PointExpirationSettings__c settings = FieloPLT__PointExpirationSettings__c.getOrgDefaults();
settings.BatchSize__c = 200;
settings.MaxChain__c = 20;
settings.DMLLimit__c = 2500;
settings.MaxRange__c = 365;
settings.ExecutionMode__c = 'Member';
settings.QueryLimit__c = 45000;
settings.FromDate__c = null;
settings.ReferenceDate__c = null;
settings.MaxAttempts__c = 23;
settings.SortByMember__c = true;
upsert settings;Updated about 1 year ago
