The FieloPLT.PromotionService class includes one method.
Obtain Promotions (getPromotions)
FieloPLT.PromotionService.getPromotions (Set<String> fieldsPromotion, Set<String> fieldsRule, Set<Id> promotionIds, Id memberId, Boolean filterBySegments, String orderBy, Integer quantity, Integer offset, String dynamicFilter, String 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.
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. |
| filterBySegments (Required) | Boolean | When true, it only returns the Promotions that belong to Member's Segment, otherwise it returns all Promotions. When null, default value is false. |
| 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. |
| 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 components in the default language. |
Return Value
| Type | Description |
|---|---|
List<FieloPLT\_\_Promotion\_\_c> | List of Promotions, which may include Rules related list (FieloPLT__Rules__r). |
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);