The FieloPLT.PromotionService class includes one method.
Obtain Promotions (getPromotions)
FieloPLT.PromotionService.getPromotions (Set<String> fieldsPromotion, Set<String> fieldsRule, Set<Id> promotionIds, Id memberId, String orderBy, String setName, Integer quantity, Integer offset, String dynamicFilter, Boolean translate)
It enables to retrieve information about a specific number of Promotions from a particular Member. It can also provide details about the Rules that belong to each of the Promotions.
Promotion setNameThe set name controls which set of promotions will be returned (these are case sensitive):
MyPromotions: This call will return all Promotions applicable to the member’s segment with status equal to Active, Inactive, Scheduled and Ended which either the Agreements have been accepted by the member or there is no Agreement at all.
Apply: This call will return Promotions applicable to the member’s segment with status equal to Active and Scheduled to which an Agreement has been created but not yet accepted by the Member.
Not Apply: This call will return Promotions with Segments which are not applicable for the member.
All Available: This call will return Promotions applicable to the member’s segment with status equal to Active and Scheduled, which an Agreement has been created but not yet accepted by the Member, and it will return Promotions with Segments that are not applicable for the member.
Apply By Segmentation: This call will return Promotions without Segments or with Segments applicable to the member.
Null: If parameter is left blank, then the return to the call will be all the Promotions.
Parameters
| Parameter | Type | Description |
|---|---|---|
| fieldsPromotion | Set<String> | Set of API names from Promotion fields to return in the response. When null or empty, default value is Set<String>{'id','name'}. |
| fieldsRule | Set<String> | Set of API names from Rules fields to return in the response. When null or empty, no Rules are returned. |
| promotionIds | Set<Id> | Set of Promotion IDs. |
| memberId (Required) | 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. |
| setName | String | Promotion status to filter values in the response (Values may be: MyPromotions, Apply, Not Apply, All Available, Apply By Segmentation and null). |
| dynamicFilter | String | JSON parameter to filter by an additional WHERE Clause. When null, no filter is applied. |
| translate | Boolean | If this parameter is set to true, it fetches the available translation and changes the language of the component according to the member’s Salesforce user language, while if false, it’ll return the component in the default language. |
Obtain Promotions (getPromotions)
- Check below an example of how the API can be used:
Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
String dynamicFilter = '[{"field":"FieloPLT__Status__c","value":"Active","operator":"eq","andOrOperator":""}]';
List<FieloPLT__Promotion__c> listPromotions = FieloPLT.PromotionService.getPromotions(
new Set<String>{'Id','Name'},
new Set<String>{'Id','Name'},
null,
memberId,
true,
'CreatedDate ASC',
100,
0,
dynamicFilter);Return Value
| Type | Description |
|---|---|
| List<FieloPLT__Promotion__c> | List of Promotions, which may include Rules related list (FieloPLT__Rules__r). |
