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);| Parameter | Type | Description | Required |
|---|---|---|---|
| programId | Id | ID of the program the agreement is part of. | x |
| fieldNames | Set<String> | List of API names from agreement fields to query. | x |
| fieldNames/ Id | String | ID of the active agreement linked to the program. | |
| fieldNames/ FieloPLT__Status__c | String | Status of the agreement. | |
| fieldNames/ FieloPLT__Agreement__c | String | Name 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}| Parameter | Type | Description |
|---|---|---|
| FieloPLT__Agreement__c | Set<String> | Current Agreement from the specific program. |
| FieloPLT__Agreement__c/ FieloPLT__Status__c | String | Status of the agreement. |
| FieloPLT__Agreement__c/ FieloPLT__Agreement__c | String | Name of the agreement. |
| FieloPLT__Agreement__c/ Id | String | ID 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.| Type | Description |
|---|---|
| FieloException | No agreement available. Make sure you have an available agreement. |
| FieloException | Agreement status is set to Draft. Make sure the agreement status is set to "Current". |
