HomeGuidesDeveloper HubRelease Notes
Get supportBook a chat
Developer Hub
These docs are for v2.152. Click to read the latest docs for v2.208.

FieloPLT.MemberAPI Class

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);
ParameterTypeDescriptionRequired
fieldsetSet<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
memberIdSet<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={}])
TypeDescription
List<FieloPLT.MemberAPI.MemberWrapper>Returns a member’s information according to their Id and fields.
ParameterTypeDescription
onlineSegmentsIdSpecifies 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:

TypeDescription
FieloApiException
  • Parameter {fieldset} is necessary.* When the fieldset is either invalid or empty.
FieloApiException
  • Parameter {memberId} is necessary.* When Member ID is either invalid or empty.

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);
ParametersTypeDescriptionRequired
memberFieloPLT__Member__cThe Member that is going to have their information updated.Yes
folderIdStringThe ID of the specific folder in your Salesforce org that you have uploaded the member's profile picture to.Yes
photoBase64StringImage file encoded to base64. It identifies the image that is going to be used in the Member's profileYes
fileNameStringThe 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})
TypeDescription
FieloPLT__Member__cUpdates 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:

TypeDescription
FieloApiException
  • Parameter {member} is necessary.* When Member ID is either invalid or empty.
FieloApiException
  • Parameter {folderId} is necessary.* When folder ID is either invalid or empty.
FieloApiException
  • Parameter {photoBase64} is necessary.* When photoBase64 is either invalid or empty.

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);
ParametersTypeDescriptionRequired
typeStringUse individual, organization or contributor. If null, the method returns a list with all the members.No
userIdStringA specific User's ID.Yes
fieldsetStringUsed 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})
TypeDescription
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:

TypeDescription
FieloApiException
  • Parameter {userId} is necessary.* When User ID is either invalid or empty.
FieloApiException
  • Parameter {fieldset} is necessary.* When fieldset is either invalid or empty.

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});
ParameterTypeDescriptionRequired
memberIdsSet<Id>Specify the ID(s) of the Member(s) from whom you want to reset the accumulated cap.Yes
capIdsSet<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.