Revenue Management API Developer Reference

ffrr.RevenueScheduleService

global with sharing class RevenueScheduleService

Contains methods for Revenue Schedule operations.

Methods

deleteOrphanedSchedules

global static ffrr.RevenueScheduleService.DeleteResult deleteOrphanedSchedules(Set<Id> scheduleIds)

Processes List of ffrr__RevenueSchedule__c Id for deletion. If there are no ffrr__RevenueScheduleLine__c marked complete for the schedule and if there is no source, the source does not have a template mapped, or the source is marked inactive then the schedule will be deleted.
If there are ffrr__RevenueScheduleLine__c marked complete for the schedule then all ffrr__RevenueScheduleLine__c that are not complete will be deleted and the ffrr__RevenueSchedule__c will be marked source unavailable.

Input Parameters

Name Type Description
scheduleIds Set<Id> Set of ffrr__RevenueScheduleLine__c.Id to process for deletion

Return Value

DeleteResult for the deleteOrphanedSchedules process

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to synchronously delete schedules
// that are missing source records, and return the DeleteResult object.
// If a schedule has no source record but contains recognized schedule lines, then only
// the unrecognized lines are deleted.

// Retrieve the Ids of the Revenue Schedules that will be used as the revenue schedule Ids from which to delete orphaned Revenue Schedules
List<ffrr__RevenueSchedule__c> revenueSchedules = [SELECT Id FROM ffrr__RevenueSchedule__c WHERE ffrr__Account__r.Name = 'FF'];
Set<Id> revenueScheduleIds = new Set<Id>();

for( ffrr__RevenueSchedule__c revenueSchedule : revenueSchedules )
{
    revenueScheduleIds.add(revenueSchedule.Id);
}

// Get the DeleteResult for the process
ffrr.RevenueScheduleService.DeleteResult result = ffrr.RevenueScheduleService.deleteOrphanedSchedules(revenueScheduleIds);

Set<Id> fullyDeletedScheduleIds = result.getFullyDeletedScheduleIds();
Set<Id> partiallyDeletedScheduleIds = result.getPartiallyDeletedScheduleIds();
Set<Id> nonDeletedScheduleIds = result.getNonDeletedScheduleIds();
Set<Id> nonDeletedScheduleLineIds = result.getNonDeletedScheduleLineIds();
Map<Id, List<String>> errorsByScheduleIds = result.getErrorsByScheduleIds();

deleteOrphanedSchedulesAsync

global static Id deleteOrphanedSchedulesAsync()

Processes ffrr__RevenueSchedule__c for deletion If there are no ffrr__RevenueScheduleLine__c marked complete for the schedule then the schedule will be deleted if there is no source, the source does not have a template mapped, or the source is marked inactive. If there are ffrr__RevenueScheduleLine__c marked complete for the schedule then ffrr__RevenueScheduleLine__c that are not recognized will be deleted.

Return Value

Id of the executing fferpcore__ProcessRun__c record.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to asynchronously delete schedules
// that are missing source records, and return the Async Apex Job Id.
// If a schedule has no source record but contains recognized schedule lines, then only
// the unrecognized lines are deleted.

// Get the Id of Async Apex Job generating the Revenue Schedules
Id jobId = ffrr.RevenueScheduleService.deleteOrphanedSchedulesAsync();

// Get AsyncApexJob status
List<AsyncApexJob> asyncJob = [SELECT Id, Status FROM AsyncApexJob WHERE Id = :jobId];

generate

global static List<Id> generate(Set<Id> sourceRecordIds)

Takes a set of source record Id and generates and inserts ffrr__RevenueSchedule__c and associated ffrr__RevenueScheduleLine__c. The ffrr__RevenueSchedule__c and ffrr__RevenueScheduleLine__c are populated with information from the source record, as defined by the associated ffrr__Settings__c, using the calculation type from the associated ffrr__Template__c.
Note: The appropriate ffrr__Settings__c and ffrr__Template__c must be set up for a source record and its type.

Input Parameters

Name Type Description
sourceRecordIds Set<Id> Set of source record Id from which to generate ffrr__RevenueSchedule__c.

Return Value

List of ffrr__RevenueSchedule__c.Id generated for sourceRecordIds.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to create a Revenue Schedule for each
// source record Id passed in to the service method, and return a list of associated Revenue Schedule Ids
// If any of the sources are not set up for revenue recognition then no schedules will be generated.

// Retrieve the Ids of the Performance Obligations that will be used as the source Ids from which to generate Revenue Schedules
List<ffrr__PerformanceObligation__c> sourceRecords = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
Set<Id> sourceRecordIds = new Set<Id>();

for( ffrr__PerformanceObligation__c sourceRecord : sourceRecords )
{
    sourceRecordIds.add(sourceRecord.Id);
}

// Get the List of Revenue Schedule Ids that have been generated by this service
List<Id> revenueScheduleIds = ffrr.RevenueScheduleService.generate(sourceRecordIds);

generate

global static Map<Id, ffrr.RevenueScheduleService.GenerateResult> generate(Set<Id> sourceRecordIds, ffrr.RevenueScheduleService.GenerateConfig config)

Takes a set of source record Id and generates and inserts or updates ffrr__RevenueSchedule__c and associated ffrr__RevenueScheduleLine__c. The ffrr__RevenueSchedule__c and ffrr__RevenueScheduleLine__c are populated with information from the source record, as defined by the associated ffrr__Settings__c, using the calculation type from the associated ffrr__Template__c.
Note: The appropriate ffrr__Settings__c and ffrr__Template__c must be set up for a source record and its type.

Input Parameters

Name Type Description
sourceRecordIds Set<Id> Set of source record Id from which to generate ffrr__RevenueSchedule__c.
config ffrr.RevenueScheduleService.GenerateConfig GenerateConfig used to specify how the generate process behaves, specifically if ffrr__RevenueSchedule__c generation stops on errors.

Return Value

Map of source record Id to GenerateResult for the processed records.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to create a Revenue Schedule for each
// source record Id passed in to the service method, and return a map of source Ids to associated results.
// The generate method is called with a GenerateConfig object that sets the all or none parameter to false.
// If a source is not set up for revenue recognition then no schedules will be generated for it.
// If a source is set up for revenue recognition then a schedule will be generated for it.

// Retrieve the Ids of the Performance Obligations that will be used as the source Ids from which to generate Revenue Schedules
List<ffrr__PerformanceObligation__c> sourceRecords = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
Set<Id> sourceRecordIds = new Set<Id>();

for( ffrr__PerformanceObligation__c sourceRecord : sourceRecords )
{
    sourceRecordIds.add(sourceRecord.Id);
}

ffrr.RevenueScheduleService.GenerateConfig config = new ffrr.RevenueScheduleService.GenerateConfig();
config.allOrNone = false;

// Get the results that have been generated by this service
Map<Id, ffrr.RevenueScheduleService.GenerateResult> results = ffrr.RevenueScheduleService.generate(sourceRecordIds, config);

for(Id sourceId : results.keySet()) {
  ffrr.RevenueScheduleService.GenerateResult result = results.get(sourceId);
  // Log the Id of the source record for which this result is associated with
  System.debug('Source Record Id ' + result.sourceRecordId);
  // Log the Id of the schedule  that was generated
  System.debug('Schedule Id ' + result.scheduleId);
  // Log the status of the generate for this source record Id
  System.debug('Success ' + result.success);
  // Log any errors that were thrown
  for(String e : result.errors) {
    System.debug('error: ' + e);
  }
}

generateAsync

global static Id generateAsync()

Generates and inserts or updates ffrr__RevenueRecognitionSchedule__c and associated ffrr__RevenueRecognitionScheduleLine__c asynchronously for all valid source records available in the Org. The ffrr__RevenueSchedule__c and ffrr__RevenueScheduleLine__c are populated with information from the source record, as defined by the associated ffrr__Settings__c, using the calculation type from the associated ffrr__Template__c.
Note: The appropriate ffrr__Settings__c and ffrr__Template__c must be set up for a source record, and its type.

Return Value

Id of the executing fferpcore__ProcessRun__c record.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to asynchronously create a Revenue Schedule for each
// available source record in the org, and return the Async Apex Job Id.
// If a source is not set up for revenue recognition then no schedules will be generated for it.
// If a source is set up for revenue recognition then a schedule will be generated for it.

// Get the Id of Async Apex Job generating the Revenue Schedules
Id batchJobId = ffrr.RevenueScheduleService.generateAsync();

// Get AsyncApexJob status
List<AsyncApexJob> batchJob = [SELECT Id, Status FROM AsyncApexJob WHERE Id = :batchJobId];

generateAsync

global static Id generateAsync(Set<Id> sourceRecordIds)

Takes a set of source record Id and generates and inserts or updates ffrr__RevenueSchedule__c and associated ffrr__RevenueScheduleLine__c asynchronously. The ffrr__RevenueSchedule__c and ffrr__RevenueScheduleLine__c are populated with information from the source record, as defined by the associated ffrr__Settings__c, using the calculation type from the associated ffrr__Template__c.
Note: The appropriate ffrr__Settings__c and ffrr__Template__c must be set up for a source record and its type.

Input Parameters

Name Type Description
sourceRecordIds Set<Id> Set of source record Id from which to generate ffrr__RevenueSchedule__c.

Return Value

Id of the executing fferpcore__ProcessRun__c record.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to asynchronously create a Revenue Schedule for each
// source record Id passed in to the service method, and return the Async Apex Job Id.
// If a source is not set up for revenue recognition then no schedules will be generated for it.
// If a source is set up for revenue recognition then a schedule will be generated for it.

// Retrieve the Ids of the Performance Obligations that will be used as the source Ids from which to generate Revenue Schedules
List<ffrr__PerformanceObligation__c> sourceRecords = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
Set<Id> sourceRecordIds = new Set<Id>();

for( ffrr__PerformanceObligation__c sourceRecord : sourceRecords )
{
    sourceRecordIds.add(sourceRecord.Id);
}

// Get the Id of Async Apex Job generating the Revenue Schedules
Id batchJobId = ffrr.RevenueScheduleService.generateAsync(sourceRecordIds);

// Get AsyncApexJob status
List<AsyncApexJob> batchJob = [SELECT Id, Status FROM AsyncApexJob WHERE Id = :batchJobId];

recognize

global static ffrr.RevenueScheduleService.RecognizeResult recognize(Set<Id> revenueScheduleLineIds, ffrr.RevenueScheduleService.RecognitionInformation recognitionInformation)

Recognizes revenue for the given Set of ffrr__RevenueScheduleLine__c.Id

Input Parameters

Name Type Description
revenueScheduleLineIds Set<Id> Set<Id> of the revenue schedule lines from which to recognize revenue.
recognitionInformation ffrr.RevenueScheduleService.RecognitionInformation Information about how the recognition process should be recorded.

Return Value

RecognizeResult for the recognized ffrr__RevenueScheduleLine__c

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to create a Revenue Recognition Transaction for each
// Revenue Schedule Line Id passed in to the service method.
// The recognize method is called with a RecognitionInformation object that sets the recognition date.

// Retrieve the Ids of the Revenue Schedule Lines that will be used to create Revenue Recognition Transactions from.
Map<Id, ffrr__RevenueScheduleLine__c> scheduleLinesByIds = new Map<Id, ffrr__RevenueScheduleLine__c>([SELECT Id, Name FROM ffrr__RevenueScheduleLine__c]);

ffrr.RevenueScheduleService.RecognitionInformation recognitionInformation = new ffrr.RevenueScheduleService.RecognitionInformation();
recognitionInformation.setRecognitionDate(Date.newInstance(2022, 01, 31));

// Get the results that have been generated by this service
ffrr.RevenueScheduleService.RecognizeResult result = ffrr.RevenueScheduleService.recognize(scheduleLinesByIds.keySet(), recognitionInformation);

for(Id successfulLineId : result.getSuccessfulLineIds()) {
  System.debug('Successful Line Id ' + successfulLineId);
}
for(Id invalidLineId : result.getInvalidLineIds()) {
  System.debug('Invalid Line Id ' + invalidLineId);

  for(String error : result.getErrorsForId(invalidLineId)) {
    System.debug('Error ' + error);
  }
}

recognizeAsync

global static Id recognizeAsync(ffrr.RevenueScheduleService.RecognitionFilters recognitionFilters, ffrr.RevenueScheduleService.RecognitionInformation recognitionInformation)

Recognizes revenue for the ffrr__RevenueScheduleLine__c described by recognitionFilters.

Input Parameters

Name Type Description
recognitionFilters ffrr.RevenueScheduleService.RecognitionFilters Configuration describing which records to recognize.
recognitionInformation ffrr.RevenueScheduleService.RecognitionInformation Information about how the recognition process should be recorded.

Return Value

Id of the executing fferpcore__ProcessRun__c record.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to asynchronously create a Revenue Recognition Transaction with associated lines for each
// source record type and revenue stream based on the Revenue Schedule Line Id passed in to the service method.
// If the provided ffrr.RecognitionFilters configuration object has no fromDate all valid records from start of time will be retrieved
// If the provided ffrr.RecognitionFilters configuration object has no untilDate all valid records until end of time will be retrieved
// If the provided ffrr.RecognitionFilters configuration object has no revenueScheduleLineIds all valid records will be retrieved in conjunction of the fromDate and untilDate

// Retrieve the Ids of the Revenue Schedule Lines that will be used to create Revenue Recognition Transactions from.
Map<Id, ffrr__RevenueScheduleLine__c> scheduleLinesByIds = new Map<Id, ffrr__RevenueScheduleLine__c>([SELECT Id, Name FROM ffrr__RevenueScheduleLine__c]);

ffrr.RevenueScheduleService.RecognitionFilters recognitionFilters = new ffrr.RevenueScheduleService.RecognitionFilters();
recognitionFilters.setFromDate(Date.newInstance(2022, 01, 01));
recognitionFilters.setUntilDate(Date.newInstance(2022, 01, 31));

ffrr.RevenueScheduleService.RecognitionInformation recognitionInformation = new ffrr.RevenueScheduleService.RecognitionInformation();
recognitionInformation.setRecognitionDate(Date.newInstance(2022, 01, 31));

// Sets the optional revenue schedule line Ids to be taken into consideration when recognizing schedules
recognitionFilters.setRevenueScheduleLineIds(scheduleLinesByIds.keySet());

// Calls recognition service
ffrr.RevenueScheduleService.recognizeAsync(recognitionFilters, recognitionInformation);

synchronize

global static ffrr.RevenueScheduleService.SynchronizeResult synchronize(Set<Id> sourceRecordIds)

Synchronizes ffrr__RevenueSchedule__c with their associated source records If a source record has become unavailable and there are no ffrr__RevenueScheduleLine__c marked complete for the schedule, then the ffrr__RevenueSchedule__c and all its ffrr__RevenueScheduleLine__c will be deleted. A source record can become unavailable if it has been deleted, if it does not have a template, or if it is marked inactive.
If a source record has become unavailable and there are ffrr__RevenueScheduleLine__c marked complete for the schedule, then any ffrr__RevenueScheduleLine__c that are not recognized will be deleted. Complete and Opening Balance lines persist.
If a source record has changed then the associated ffrr__RevenueSchedule__c and its ffrr__RevenueScheduleLine__c will be updated to reflect the changes.

Input Parameters

Name Type Description
sourceRecordIds Set<Id> Ids of the source records to synchronize with ffrr__RevenueSchedule__c where applicable.

Return Value

SynchronizeResult for the processed records.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to synchronize Revenue Schedules for each
// source record Id passed in to the service method, and return a SynchronizeResult object
// containing information about how the process completed

// Retrieve the Ids of the Performance Obligations that will be used as the source Ids from which to synchronize Revenue Schedules
List<ffrr__PerformanceObligation__c> sourceRecords = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
Set<Id> sourceRecordIds = new Set<Id>();

for( ffrr__PerformanceObligation__c sourceRecord : sourceRecords )
{
    sourceRecordIds.add(sourceRecord.Id);
}

// Get the SynchronizeResult, any errors will be thrown as an exception
ffrr.RevenueScheduleService.SynchronizeResult result = ffrr.RevenueScheduleService.synchronize(sourceRecordIds);
Set<Id> generatedSchedulesSourceIds = result.getGeneratedSchedulesSourceIds();
System.debug('Generated Schedules Source Ids');
for(Id sourceIds : generatedSchedulesSourceIds) {
  System.debug(sourceIds);
}
Set<Id> sourceIdsWithFullyDeletedSchedules = result.getSourceIdsWithFullyDeletedSchedules();
System.debug('Source Ids With Fully Deleted Schedules');
for(Id sourceIds : sourceIdsWithFullyDeletedSchedules) {
  System.debug(sourceIds);
}
Set<Id> sourceIdsWithPartiallyDeletedSchedules = result.getSourceIdsWithPartiallyDeletedSchedules();
System.debug('Source Ids With Partially Deleted Schedules');
for(Id sourceIds : sourceIdsWithPartiallyDeletedSchedules) {
  System.debug(sourceIds);
}
Set<Id> sourceIdsWithNonDeletedSchedules = result.getSourceIdsWithNonDeletedSchedules();
System.debug('Source Ids With Non Deleted Schedules');
for(Id sourceIds : sourceIdsWithNonDeletedSchedules) {
  System.debug(sourceIds);
}

synchronize

global static ffrr.RevenueScheduleService.SynchronizeResult synchronize(Set<Id> sourceRecordIds, ffrr.RevenueScheduleService.SynchronizeConfig config)

Synchronizes ffrr__RevenueSchedule__c with their associated source records If a source record has become unavailable and there are no ffrr__RevenueScheduleLine__c marked complete for the schedule, then the ffrr__RevenueSchedule__c and all its ffrr__RevenueScheduleLine__c will be deleted. A source record can become unavailable if it has been deleted, if it does not have a template, or if it is marked inactive.
If a source record has become unavailable and there are ffrr__RevenueScheduleLine__c marked complete for the schedule, then any ffrr__RevenueScheduleLine__c that are not recognized will be deleted. Complete and Opening Balance lines persist.
If a source record has changed then the associated ffrr__RevenueSchedule__c and its ffrr__RevenueScheduleLine__c will be updated to reflect the changes.

Input Parameters

Name Type Description
sourceRecordIds Set<Id> Ids of the source records to synchronize with ffrr__RevenueSchedule__c where applicable.
config ffrr.RevenueScheduleService.SynchronizeConfig SynchronizeConfig used to specify how the synchronize process behaves.

Return Value

SynchronizeResult for the processed records.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// In this example the Revenue Schedule Service is used to synchronize Revenue Schedules for each
// source record Id passed in to the service method, and return a SynchronizeResult object
// containing information about how the process completed. This example uses a configuration object
// to set up how synchronize should be performed.

// Retrieve the Ids of the Performance Obligations that will be used as the source Ids from which to synchronize Revenue Schedules
List<ffrr__PerformanceObligation__c> sourceRecords = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
Set<Id> sourceRecordIds = new Set<Id>();

for( ffrr__PerformanceObligation__c sourceRecord : sourceRecords )
{
    sourceRecordIds.add(sourceRecord.Id);
}

ffrr.RevenueScheduleService.SynchronizeConfig config = new ffrr.RevenueScheduleService.SynchronizeConfig();
config.allOrNone = false;

// Get the SynchronizeResult, with this config any errors will be logged rather than thrown
ffrr.RevenueScheduleService.SynchronizeResult result = ffrr.RevenueScheduleService.synchronize(sourceRecordIds, config);
Set<Id> generatedSchedulesSourceIds = result.getGeneratedSchedulesSourceIds();
System.debug('Generated Schedules Source Ids');
for(Id sourceIds : generatedSchedulesSourceIds) {
  System.debug(sourceIds);
}
Set<Id> sourceIdsWithFullyDeletedSchedules = result.getSourceIdsWithFullyDeletedSchedules();
System.debug('Source Ids With Fully Deleted Schedules');
for(Id sourceIds : sourceIdsWithFullyDeletedSchedules) {
  System.debug(sourceIds);
}
Set<Id> sourceIdsWithPartiallyDeletedSchedules = result.getSourceIdsWithPartiallyDeletedSchedules();
System.debug('Source Ids With Partially Deleted Schedules');
for(Id sourceIds : sourceIdsWithPartiallyDeletedSchedules) {
  System.debug(sourceIds);
}
Set<Id> sourceIdsWithNonDeletedSchedules = result.getSourceIdsWithNonDeletedSchedules();
System.debug('Source Ids With Non Deleted Schedules');
for(Id sourceIds : sourceIdsWithNonDeletedSchedules) {
  System.debug(sourceIds);
}

Map<Id, List<String>> allErrorsBySourceIds = result.getAllErrorsBySourceIds();
System.debug('Get All Errors By Source Ids');
for(Id sourceId : allErrorsBySourceIds.keySet()) {
  List<String> errorMessages = result.getErrorsForSourceId(sourceId);
  System.debug('Source Id ' + sourceId);
  for(String errorMessage : errorMessages) {
    System.debug(errorMessage);
  }
}

ffrr.RevenueScheduleService.GenerateConfig

global with sharing class GenerateConfig

Class that contains the configuration to be used for generating schedules

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Configure the way generate revenue schedules should be performed
ffrr.RevenueScheduleService.GenerateConfig config = new ffrr.RevenueScheduleService.GenerateConfig();

// Set the allOrNone configuration to false to continue with schedule generation process even if one or more of the schedules could not be created
config.allOrNone = false;

Properties

Name Type Description
allOrNone Boolean Boolean to specify whether the generation should be all or none. If true when a record is invalid then all schedules will fail to be generated. If false, only valid records will cause a schedule to be generated. If unset defaults to true.

Methods

GenerateConfig

global GenerateConfig()

ffrr.RevenueScheduleService.GenerateResult

global with sharing class GenerateResult

Class that contains the results given back from the generate process.

Properties

Name Type Description
sourceRecordId Id Id of the source record associated with these results.
scheduleId Id Id of the generated revenue schedule.
success Boolean Boolean to indicate whether the revenue schedule was generated.
errors List<String> List of errors that occurred when attempting to generate the revenue schedule.

ffrr.RevenueScheduleService.RecognitionFilters

global inherited sharing class RecognitionFilters

Identifies the information to be recognized by a recognize method. Adding multiple filters, such as line Ids and an until date, will join the filter together with an AND. This means only Revenue Schedule Lines with Ids in Id set AND date =< untilDate will be processed.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Configure the way recognizing of Revenue Schedules should be performed
ffrr.RevenueScheduleService.RecognitionFilters recognitionFilters = new ffrr.RevenueScheduleService.RecognitionFilters();

// Sets the date (inclusive) dictating when we start taking Revenue Schedule Lines into consideration for recognition
recognitionFilters.setFromDate(Date.newInstance(2022, 01, 01));

// Sets the date (inclusive) dictating when we stop taking Revenue Schedule Lines into consideration for recognition
recognitionFilters.setUntilDate(Date.newInstance(2022, 01, 31));

// Sets the optional revenue schedule line Ids to be taken into consideration when recognizing schedules
// If passed in only those schedule lines will be recognized, otherwise all valid schedule lines will be recognized
Map<Id, ffrr__RevenueScheduleLine__c> scheduleLinesByIds = new Map<Id, ffrr__RevenueScheduleLine__c>([SELECT Id, Name FROM ffrr__RevenueScheduleLine__c]);
recognitionFilters.setRevenueScheduleLineIds(scheduleLinesByIds.keySet());

Methods

RecognitionFilters

global RecognitionFilters()

setFromDate

global void setFromDate(Date fromDate)

Sets the date (inclusive) after which we start taking Revenue Schedule Lines into consideration for recognition.

Input Parameters

Name Type Description
fromDate Date Date after which Revenue Schedule Lines start getting taken into consideration for recognizing

setUntilDate

global void setUntilDate(Date untilDate)

Sets the date (inclusive) until we stop taking Revenue Schedule Lines into consideration for recognition.

Input Parameters

Name Type Description
untilDate Date Date until Revenue Schedule Lines will be taken into consideration for recognizing

setRevenueScheduleLineIds

global void setRevenueScheduleLineIds(Set<Id> revenueScheduleLineIds)

Sets the optional revenue schedule line Ids to be taken into consideration when recognizing schedules. If any schedules are passed to this method then only those schedule lines will be recognized, otherwise all valid schedule lines will be recognized. Any null values will be removed from the set of schedule line Ids.

Input Parameters

Name Type Description
revenueScheduleLineIds Set<Id> Set of schedule line Id's to be recognized

setRevenueScheduleLineIds

global void setRevenueScheduleLineIds(List<Id> revenueScheduleLineIds)

Sets the optional revenue schedule line Ids to be taken into consideration when recognizing schedules. If any schedules are passed to this method then only those schedule lines will be recognized, otherwise all valid schedule lines will be recognized. Any null values will be removed from the list of schedule line Ids.

Input Parameters

Name Type Description
revenueScheduleLineIds List<Id> List of schedule Line Id's to be recognized

ffrr.RevenueScheduleService.RecognitionInformation

global inherited sharing class RecognitionInformation

Information required by the recognition process

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Configure the way recognizing of Revenue Schedules should be performed
ffrr.RevenueScheduleService.RecognitionInformation recognitionInformation = new ffrr.RevenueScheduleService.RecognitionInformation();

// Sets the date which will appear on all the Revenue Recognition Transaction Lines as their recognition date
recognitionInformation.setRecognitionDate(Date.newInstance(2022, 01, 31));

// Gets the currently set recognitionDate
Date recognitionDate = recognitionInformation.getRecognitionDate();

Methods

RecognitionInformation

global RecognitionInformation()

setRecognitionDate

global void setRecognitionDate(Date recognitionDate)

Sets the date which will appear on all the Revenue Recognition Transaction Lines as their recognition date

Input Parameters

Name Type Description
recognitionDate Date Date determining what gets stamped on the revenue schedule lines as their recognition date

ffrr.RevenueScheduleService.RecognizeResult

global inherited sharing class RecognizeResult

Class that contains the results given back from the recognize process.

Methods

RecognizeResult

global RecognizeResult()

getSuccessfulLineIds

global Set<Id> getSuccessfulLineIds()

getInvalidLineIds

global Set<Id> getInvalidLineIds()

getErrorsForId

global Set<String> getErrorsForId(Id invalidID)

ffrr.RevenueScheduleService.DeleteResult

global inherited sharing class DeleteResult

Class that contains the results given back from the deleteOrphanedSchedules process.

Methods

getFullyDeletedScheduleIds

global Set<Id> getFullyDeletedScheduleIds()

public no args constructor to prevent instantiation of a result object outside of the managed package.

getPartiallyDeletedScheduleIds

global Set<Id> getPartiallyDeletedScheduleIds()

getNonDeletedScheduleIds

global Set<Id> getNonDeletedScheduleIds()

getNonDeletedScheduleLineIds

global Set<Id> getNonDeletedScheduleLineIds()

getErrorsByScheduleIds

global Map<Id, List<String>> getErrorsByScheduleIds()

ffrr.RevenueScheduleService.SynchronizeConfig

global inherited sharing class SynchronizeConfig

Class that contains the configuration to be used for synchronizing schedules

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Configure the way synchronize revenue schedules should be performed
ffrr.RevenueScheduleService.SynchronizeConfig config = new ffrr.RevenueScheduleService.SynchronizeConfig();

// Set the allOrNone configuration to false to continue with schedule synchronization process even if one or more of the schedules could not be synchronized
config.allOrNone = false;

Properties

Name Type Description
allOrNone Boolean Boolean to specify whether synchronize should be all or none. If true when a record is invalid then all schedules will fail to be generated. If false, only valid records will cause a schedule to be generated. If unset defaults to true.

Methods

SynchronizeConfig

global SynchronizeConfig()

ffrr.RevenueScheduleService.SynchronizeResult

global inherited sharing class SynchronizeResult

Class that contains the results given back from the synchronize process.

Methods

getGeneratedSchedulesSourceIds

global Set<Id> getGeneratedSchedulesSourceIds()

public no args constructor to prevent instantiation of a result object outside of the managed package.

getSourceIdsWithFullyDeletedSchedules

global Set<Id> getSourceIdsWithFullyDeletedSchedules()

getSourceIdsWithPartiallyDeletedSchedules

global Set<Id> getSourceIdsWithPartiallyDeletedSchedules()

getSourceIdsWithNonDeletedSchedules

global Set<Id> getSourceIdsWithNonDeletedSchedules()

getScheduleIdForSourceId

global Id getScheduleIdForSourceId(Id sourceId)

getErrorsForSourceId

global List<String> getErrorsForSourceId(Id sourceId)

getAllErrorsBySourceIds

global Map<Id, List<String>> getAllErrorsBySourceIds()

© Copyright 2009–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.