The FieloPLT.TrackerService class includes one method.
Revert Trackers (revertTrackers)
static Map<Id,String> FieloPLT.TrackerService.revertTrackers (Set<Id> trackerIds, Set<Id> toBeReverted, Map<Id,FieloPLT__RuleTrigger__c> ruleTriggersMap)
Lets you get a set of Tracker IDs from records which have been already processed in Missions and which can be reverted. Only the specified Trackers are reverted.
Parameters
| Parameter | Type | Description |
|---|---|---|
| trackerIds | Set<Id> | Set of Trackers IDs to revert. |
| toBeReverted | Set<Id> | Set of the processed record IDs to revert. |
| ruleTriggersMap | Map<Id,FieloPLT__RuleTrigger__c> | Map of the Rule Triggers related to the Trackers. |
Return Value
| Type | Description |
|---|---|
| Map<Id,String> | Map of reverted Trackers. If operation is successful, value is 'Ok', otherwise you'll get an error message. |
Revert Trackers (revertTrackers)
- Check below an example of how the API can be used:
//"memberExample" is an Individual Member. There is an Rule Trigger for the object Event, whose 'Type'='Registration'. There's a Challenge whose 'Status'='Active' including a Mission whose 'Objective Type'='Summary', 'Objective Value'= 'Value' field of Event.
FieloPLT__Event__c event = new FieloPLT__Event__c(
FieloPLT__Member__c = memberExample.Id,
FieloPLT__Type__c = 'Registration',
FieloPLT__Value__c = 10
);
insert event;
map<Id, Tracker__c> trackersIds = new map<Id, Tracker__c>([SELECT Id FROM Tracker__c WHERE FieloPLT__Event__c =: event.Id]);
Map<Id, String> errors = TrackerService.revertTrackers(trackersIds.keySet(), new Set<Id>{event.Id}, null);
List<FieloPLT__Tracker__c> trackers = [SELECT Id, IsReverted__c FROM FieloPLT__Tracker__c WHERE FieloPLT__Event__c =: event.Id];
System.assertEquals(trackers.size(), 1);
System.assertEquals(trackers.get(0).IsReverted__c, true);
If you're reverting a tracker that accomplished an incentive and that generated a transaction that has records related to regular currencies and currencies that generate payout, only the regular ones will be reverted.To revert a currency that generates payout, you must access the payout page, reject it and edit its amount.
