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.AgreementService Class

FieloPLT.AgreementService class includes two methods.

Obtain Current Agreement (getCurrentAgreement)

static FieloPLT__Agreement__c FieloPLT.AgreementService.getCurrentAgreement (Id programId, Set<String> fieldNames)

Agreement sets the terms and conditions that members need to accept in order to take part in a program. This API allows you to obtain the Agreement with status set as current that belongs to a specific program.

Parameters

Here you'll find a definition of its parameters:

Obtain Current Agreement (getCurrentAgreement)

  • Check below an example of how the API can be used:
Id programId = [SELECT Id FROM FieloPLT__Program__c LIMIT 1].Id;

Set<String> fields = new Set<String>{'Id', 'FieloPLT__Status__c', 'FieloPLT__Agreement__c', 'FieloPLT__Promotion__c','FieloPLT__Challenge__c'};

FieloPLT__Agreement__c agreement = FieloPLT.AgreementService.getCurrentAgreement(programId, fields);
ParameterTypeDescriptionRequired
programIdIdID of the program the agreement is part of.x
fieldNamesSet<String>List of API names from agreement fields to query.x
fieldNames/ IdStringID of the active agreement linked to the program.
fieldNames/ FieloPLT__Status__cStringStatus of the agreement.
fieldNames/ FieloPLT__Agreement__cStringName of the agreement.

Return Values

Here you'll find a definition of the return values:

  • Take a look below in an example of what is returned in the call:
FieloPLT__Agreement__c:{FieloPLT__Status__c=Current, FieloPLT__Agreement__c=TermsofService, Id=a020W00000Jp29XQAR}
ParameterTypeDescription
FieloPLT__Agreement__cSet<String>Current Agreement from the specific program.
FieloPLT__Agreement__c/ FieloPLT__Status__cStringStatus of the agreement.
FieloPLT__Agreement__c/ FieloPLT__Agreement__cStringName of the agreement.
FieloPLT__Agreement__c/ IdStringID of the active agreement linked to the program.

Exceptions

Errors can occur when you use the endpoint. Use the message description to troubleshoot them.

FieloPLT.FieloException: Program does not have a "Current" Agreement available.
TypeDescription
FieloExceptionNo agreement available. Make sure you have an available agreement.
FieloExceptionAgreement status is set to Draft. Make sure the agreement status is set to "Current".