FieloPLT.ChallengeService class includes one method.
Obtain Challenges (getChallengesMap)
static List<FieloPLT.ChallengeService.ChallengeWrapper> FieloPLT.ChallengeService.getChallengesMap (Set<String> fieldsChallenge, Set<String> fieldsMission, Set<String> fieldsChReward, Set<String> fieldsMissionMember, Set<String> fieldsChMember, Set<String> fieldsTransaction, Set<Id> challengeIds, Id memberId, String status, Boolean filterBySegments, String orderBy, Integer quantity, Integer offset, String dynamicFilter)
It allows you to retrieve information about a number of Challenges map from a particular Member. It can also provide details about the Missions, Challenge Rewards, Challenge Members, Mission Members and Transactions linked to a Challenge.
Members are considered subscribed to a Challenge when Members and Challenge share the same Segment and Subscription Mode is Global. When Subscription Mode is Closed, Members are considered subscribed by means of a Challenge Member record.
Challenges statusChallenges may have any of the following status when linked to a specific Member:
- Active: Member is subscribed to a Challenge with status Active. Challenge Member status must not be Accomplished (E.g. Member has "My Challenges" section).
- Completed: Member is subscribed to a Challenge with status Completed, or to a Challenge with status Active but the Challenge Member status must be Accomplished.
- Open: Members may be subscribed to the Challenge as they share the same Segment. Challenge is Active and its Subscription mode must be Closed.
- Lost: Member may be subscribed to the Challenge as they share the same Segment. Challenge is not Active and its Subscription mode must be Closed.
- Not Applicable: Although Challenge is Active, Members are not subscribed as they do not share the same Segment.
Parameters
| Parameter | Type | Description |
|---|---|---|
| fieldsChallenge | Set<String> | Set of API Names from Challenge fields to return in the response. |
| fieldsMission | Set<String> | Set of API Names from Mission fields to return in the response. |
| fieldsChReward | Set<String> | Set of API Names from Challenge Reward fields to return in the response. |
| fieldsMissionMember | Set<String> | Set of API Names from Mission Member fields to return in the response. |
| fieldsChMember | Set<String> | Set of API Names from Challenge Member fields to return in the response. |
| fieldsTransaction | Set<String> | Set of API Names from Transaction fields to return in the response. |
| challengeIds | Set<Id> | Set of Challenge IDs. |
| memberId | Id | ID of a specific Member. |
| status | String | Challenge status to filter values in the response (Values may be: Active, Completed, Open, Lost and Not Applicable). |
| filterBySegments | Boolean | It returns the Challenges that belong to Member's Segment. |
| quantity | Integer | Number of items to be retrieved. When NULL, query return all items. |
| offset | Integer | Number of records from a collection to skip. When null, no records are skipped. |
| orderBy | String | Records returned in an ascending or descending order. |
| dynamicFilter | String | JSON parameter to filter by an additional WHERE Clause. When null, no filter is applied. |
Return Value
| Type | Description |
|---|---|
List<FieloPLT.ChallengeService.ChallengeWrapper> | List of Challenge Wrappers. Challenge Wrappers include the following attributes: |
Class FieloPLT.ChallengeWrapper{
FieloPLT__Challenge__c challenge;
String status;
FieloPLT__ChallengeMember__c challengeMember;
List<FieloPLT__Mission__c> missions;
List<FieloPLT__ChallengeReward__c> challengeRewards;
Map<Id,List<FieloPLT__ChallengeReward__c>> missionRewards;
Map<Id,FieloPLT__MissionMember__c> missionsMember;
List<FieloPLT__Transaction__c> transactions;
}Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
String dynamicFilter = '[{"field":"FieloPLT__Status__c","value":"Active","operator":"eq","andOrOperator":""}]';
List<FieloPLT.ChallengeService.ChallengeWrapper> result = FieloPLT.ChallengeService.getChallengesMap(
new Set<String>{'Name'},
new Set<String>{'Name'},
new Set<String>{'Name'},
null,
null,
null,
null,
memberId,
null,
true,
'CreatedDate ASC',
100,
0,
dynamicFilter);Obtain Mission Leaderboard (getMissionLeaderboard)
static List<FieloPLT__MissionMember__c> getMissionLeaderboard (Set<String> fieldsMissionMember, Id missionId, Id memberId, String orderBy, Integer quantity, Integer offset, String dynamicFilter)
It enables you to retrieve information about Member rankings in a Leaderboard of a specific Mission, which is stored in Mission Member records. You can also obtain information about how a particular Member has performed on the Leaderboard.
| Parameter | Type | Description |
|---|---|---|
| fieldsMissionMember | Set<String> | Set of API Names from Mission Member fields to return in the response. |
| challengeIds | Set<Id> | Set of Challenge IDs. |
| memberId | Id | ID of a specific Member. |
| quantity | Integer | Number of items to be retrieved. When NULL, query return all items. |
| offset | Integer | Number of records from a collection to skip. When null, no records are skipped. |
| orderBy | String | Records returned in an ascending or descending order. |
| dynamicFilter | String | JSON parameter to filter by an additional WHERE Clause. When NULL, no filter is applied. |
Return Value
Challenge Leaderboard BatchYou must run Challenge Leaderboard batch job before calling Obtain Mission Leaderboard method.
| Type | Description |
|---|---|
List<FieloPLT**MissionMember**c> | List of Mission Members. If the Challenge Leaderboard batch job is not run, it returns value is either NULL or empty. |
Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
Id missionId = [SELECT Id FROM FieloPLT__Mission__c LIMIT 1].Id;
String dynamicFilter = '[{"field":"FieloPLT__Status__c","value":"Accomplished","operator":"eq","andOrOperator":""}]';
List<FieloPLT__MissionMember__c> FieloPLT.ChallengeService.getMissionLeaderboard(new Set<String>{'Name'},
missionId,
memberId,
'CreatedDate ASC',
100,
0,
dynamicFilter);