Generally used for the Profile and Member Selector components, the FieloPLT.MemberAPI Class includes three methods.
Get Member (getMember)
List<MemberAPI.MemberWrapper> FieloPLT.MemberAPI.getMember(Set<String> fieldset, Set<String> memberId)
Use this method in order to get a specific member's information - such as their name, type, and amount of Points - based on the parameters sent. This is highly used in the Member Selector component, where the member can overview their information.
In case the member applies to any dynamic segment you have created in your org, the method will also return the segment's ID.
Take a look at a step by step guide on how to use this method.
Parameters
Check an example of how the API can be used below and a definition of its parameters right after:
//Get member Id
Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
Set<Id> memberIds = new Set<Id>{memberId};
//Create fieldset
Set<String> fieldset = new Set<String>{'Id', 'Name', 'FieloPLT__Program__c'};
List<MemberAPI.MemberWrapper> lstMemberWrapper = FieloPLT.MemberAPI.getMembers(fieldset, memberIds);| Parameter | Type | Description | Required |
|---|---|---|---|
| fieldset | Set<String> | Used to specify which fields from the Member Object you want to retrieve. E.g. Name, Type__c, Points__c. If null, returns Id and Name. | Yes |
| memberId | Set<String> | Specify the ID of the Member from which you want to get information about. | Yes |
Return Value
Take a look below at an example of what is returned in the call and a definition of the return values right after:
//Example of member with segment
(MemberWrapper:[member=FieloPLT__Member__c:{Id=a0d1h000001iJiZAAU, Name=Member, FieloPLT__Program__c=a0p1h000001T1gnAAC}, onlineSegments={a101h000001R1i8AAC, a101h000001R8ppAAC}])
//Example of member without segment
(MemberWrapper:[member=FieloPLT__Member__c:{Id=a0d1h000001iQIhAAM, Name=NoSeg, FieloPLT__Program__c=a0p1h000001T1gnAAC}, onlineSegments={}])| Type | Description |
|---|---|
| List<FieloPLT.MemberAPI.MemberWrapper> | Returns a member’s information according to their Id and fields. |
| Parameter | Type | Description |
|---|---|---|
| onlineSegments | Id | Specifies the IDs of the dynamic segments that the member is part of. If there aren't any dynamic segments that the member is part of, it returns onlineSegments={}. |
Exception
Errors can occur when you use the endpoint. See below the exception that you can receive when using the getMember:
| Type | Description |
|---|---|
| FieloApiException |
|
| FieloApiException |
|
Update Member Information (updateMemberInfo)
FieloPLT__Member__c FieloPLT.MemberAPI.updateMemberInfo (FieloPLT__Member__c member, String folderId, String fileName, String photoBase64)
updateMemberInfo makes it possible to update the member's information, such as their profile picture. As you may infer, this method is mostly used in the Profile component and its objective is to save the information sent to the server beforehand.
Take a look at a step by step guide on how to use this method.
Parameters
Check an example of how the API can be used below and a definition of its parameters right after:
FieloPLT__Member__c member = [SELECT Id, Name FROM FieloPLT__Member__c LIMIT 1];
member.Name = 'Abigail';
//Get the Id of the folder where the image will be saved
Id folderId = [SELECT Id, Name FROM Folder WHERE Type = 'Document' LIMIT 1].Id;
String folder = String.valueOf(folder);
String fileName = 'member.jpg';
String photoBase64 = 'data:image/png;base64,iVBORw0KGg...';
FieloPLT__Member__c memberInfo = FieloPLT.MemberAPI.updateMemberInfo(member, folder, fileName, photoBase64);| Parameters | Type | Description | Required |
|---|---|---|---|
| member | FieloPLT__Member__c | The Member that is going to have their information updated. | Yes |
| folderId | String | The ID of the specific folder in your Salesforce org that you have uploaded the member's profile picture to. | Yes |
| photoBase64 | String | Image file encoded to base64. It identifies the image that is going to be used in the Member's profile | Yes |
| fileName | String | The image file's name within Salesforce. | Yes |
Return Value
Take a look below at an example of what is returned in the call and a definition of the return values right after:
(FieloPLT__Member__c:{Name=Member, FieloPLT__Program__c=a0p54000002S4g5AAC, Id=a0d54000007ZCghAAG})| Type | Description |
|---|---|
| FieloPLT__Member__c | Updates the member's information. |
Exception
Errors can occur when you use the endpoint. See below the exception that you can receive when using the updateMemberInfo:
| Type | Description |
|---|---|
| FieloApiException |
|
| FieloApiException |
|
| FieloApiException |
|
Get Member By User and Type (getMembersByUserAndType)
List<FieloPLT__Member__c> FieloPLT.MemberAPI.getMembersByUserAndType(String type, String userId, String fieldset)
When the User has more than one member associated with them, use this method. It gets a list of members from a specific type (individual, organization, or contributor) that share the same User.
It can be used, for example, as a way to allow Individual members (managers) to access the details regarding the Organization member that they share a User with, or the Organization members to access the information from the Contributor members that have the same User as them.
Take a look at a step by step guide on how to use this method.
Parameters
Check an example of how the API can be used below and a definition of its parameters right after:
String type = 'Individual';
String userId = UserInfo.getUserId();
//Create fieldset
Set<String> fieldset = new Set<String>{'Id', 'Name', 'FieloPLT__Program__c'};
List<Member__c> lstMember = FieloPLT.MemberAPI.getMembersByUserAndType(type, userId, fieldset);| Parameters | Type | Description | Required |
|---|---|---|---|
| type | String | Use individual, organization or contributor. If null, the method returns a list with all the members. | No |
| userId | String | A specific User's ID. | Yes |
| fieldset | String | Used to specify which fields from the Member Object you want to retrieve. E.g. Name, Type__c, Points__c. | Yes |
Return Value
Take a look below at an example of what is returned in the call and a definition of the return values right after:
(FieloPLT__Member__c:{Name=Member 2, FieloPLT__Program__c=a0p54000002S4g5AAC, Id=a0d54000007ZCghAAG}, FieloPLT__Member__c:{Name=Jane Doe, FieloPLT__Program__c=a0p54000002S4g5AAC, Id=a0d54000007Yut6AAC})| Type | Description |
|---|---|
List<FieloPLT\_\_Member\_\_c> | Returns all members with the same user, filtered by type. |
Exception
Errors can occur when you use the endpoint. See below the exception that you can receive when using the getMembersByUserAndType:
| Type | Description |
|---|---|
| FieloApiException |
|
| FieloApiException |
|
Remove Caps (removeCaps)
void removeCaps(Set<Id> memberIds, Set<Id> capIds)
This method is not related only to Sites
Use this method to reset the members' capping accumulated value so that their next transactions will start to count to the capping rule again - from zero.
Members who are marked as having reached the capping limit will not have their next transactions processed by Fielo until the assigned cap period has ended, even if you update the cap limit and/or period. So, this is a useful method in case you need to clean the capping history related to several members and several capping rules at once.
Parameters
Check an example of how the API can be used below and a definition of its parameters right after:
// Get member Id
Id memberId = [SELECT Id FROM FieloPLT__Member__c LIMIT 1].Id;
Set<Id> memberIds = new Set<Id>{memberId};
// Get cap Id
Id capId = [SELECT Id FROM FieloPLT__Cap__c WHERE Status__c = 'Active' LIMIT 1].Id;
FieloPLT.MemberAPI.removeCaps(new Set<Id>{memberId}, new Set<Id>{capId});| Parameter | Type | Description | Required |
|---|---|---|---|
| memberIds | Set<Id> | Specify the ID(s) of the Member(s) from whom you want to reset the accumulated cap. | Yes |
| capIds | Set<Id> | Specify the ID(s) of the Caps from which you want to reset accumulated value for the Member(s). | Yes |
Check the Member's record to verify if their accumulated value related to the Cap(s) has been reset.
