Revenue Management API Developer Reference

ffrr.RevenueScheduleAutomationService

global with sharing class RevenueScheduleAutomationService

Contains methods for Recognition Schedule automation.

Enums

AutomationProcess

Denotes an individual process that can be run by the automation service. The order these are listed here is the same order in which the processes will be run, if selected.

Value Description
DeleteSourceUnavailable The process to delete recognition schedules where the source record is unavailable.
Generate The process to generate recognition schedules from source records.
Recognize The process to recognize recognition schedules.
Summarize The process to summarize recognition transactions.
CreateJournals The process to create Accounting journals from recognition transactions.

PeriodToSelectUpTo

Denotes the cutoff period for including schedule lines for recognition.

Value Description
Current Recognizable schedule lines in all periods up to the current period will be included.
Previous Recognizable schedule lines in all periods up to and including the most recent fully complete period will be included.

PeriodToRecognizeInto

Denotes the period that recognized values will be committed into.

Value Description
Current Recognized values will be committed into the period containing today's date.
Previous Recognized values will be committed into the period immediately prior to the current period.

Methods

runProcesses

global static ffrr.RevenueScheduleAutomationService.AutomationResult runProcesses(ffrr.RevenueScheduleAutomationService.AutomationConfig configuration)

Runs the recognition schedule processes specified by the ffrr.RevenueScheduleAutomationService.AutomationConfig object from the first process to last process. See the RevenueScheduleAutomationService.AutomationProcess enum for the available values. The order in which these processes happens is as follows:
1) DeleteSourceUnavailable
2) Generate
3) Recognize
4) Summarize
5) CreateJournals

When the configuration object is supplied with a firstProcess and lastProcess every step in between is also run.
The configuration object also controls if the summarization process should be run. See the summarizeTransactions option. If not specified defaults to true. If the first to last process covers Summarize and the summarizeTransactions boolean is set to true it will summarize the recognition transactions. If the CreateJournals is also included the automation process will create journals using transaction summaries rather than recognition transaction lines.

Additionally the configuration object can be supplied with a ffrr.RevenueScheduleAutomationService.AutomationFilters object containing filters to be applied to each of the asynchronous processes being run.

When you run the service a Revenue Management background process record is created, storing log information about the individual processes being run and the filter information used when clash checking asynchronous processes. See the Revenue Management Background Processes and Filters help topic for more information.

Note CreateJournals requires the RT to Journal Integrations to be enabled and working for either recognition transaction summaries or recognition transaction lines depending on whether the summarizeTransactions flag is set to true.
Consult the Help for which records are picked up by each automation process.

Input Parameters

Name Type Description
configuration ffrr.RevenueScheduleAutomationService.AutomationConfig The configuration object for the automation process.

Exceptions Thrown

Value Description
ffrr.Exceptions.InvalidArgumentException If the AutomationConfig is invalid. The AutomationConfig is invalid if: The first process is after the last process or nothing is passed to the configuration object for either parameter. The CreateJournals process is selected and the RT to Journal Integration is not setup and working. Both the first and last process are Summarize and summarizeTransactions is false. The Recognize process is selected and RecognitionConfig is not fully populated. The Recognize process is not selected and RecognitionConfig is not null.
ffrr.Exceptions.IllegalStateException If a Recognition Schedule process ie Synchronize, Delete, Generate or Recognize is currently running then the system will throw an exception.

Return Value

Returns a ffrr.RS_AutomationService.AutomationResult object.

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.

// example 1
// In this example the automation service has been asked to run from Generate to CreateJournals including summarizing the transactions.
// The processes will be chained from one to the other including the steps in between eg. Generate, Recognize, Summarize, CreateJournals
// The Recognize process will select schedule lines up to and including the previous period, and recognize them into the previous period (default).

ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.CreateJournals;

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess);

// call the run processes method to chain the configured processes together and set the first one running.
ffrr.RevenueScheduleAutomationService.AutomationResult result = ffrr.RevenueScheduleAutomationService.runProcesses(config);

// example 2
// In this example the automation service is being used to run only a single process Generate.

ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess);

// call the run processes method to chain the configured processes together and set the first one running.
ffrr.RevenueScheduleAutomationService.AutomationResult result = ffrr.RevenueScheduleAutomationService.runProcesses(config);

// example 3
// In this example only the Recognize and CreateJournals method will be called (creating journals from recognition lines)
// The Recognize process will select schedule lines up to and including the current period, and recognize them into the current period.

ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Recognize;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.CreateJournals;

Boolean summarizeTransactions = false;

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess, summarizeTransactions);

ffrr.RevenueScheduleAutomationService.RecognitionConfig recognitionConfig = new ffrr.RevenueScheduleAutomationService.RecognitionConfig();
recognitionConfig.selectionPeriod = ffrr.RevenueScheduleAutomationService.PeriodToSelectUpTo.Current;
recognitionConfig.recognitionPeriod = ffrr.RevenueScheduleAutomationService.PeriodToRecognizeInto.Current;
config.recognitionConfig = recognitionConfig;

// call the run processes method to chain the configured processes together and set the first one running.
ffrr.RevenueScheduleAutomationService.AutomationResult result = ffrr.RevenueScheduleAutomationService.runProcesses(config);

// example 4
// In this example filters are added to the config. These will be applied to each of the automation processes run: in this example, Recognize through to Create Journals.
// They are also used in asynchronous clash checking for automation processes that clash.

ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Recognize;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.CreateJournals;

Boolean summarizeTransactions = false;

//Create filters
Set<String> filteredCompanies = new Set<String>{ 'Company A' };
Set<String> filteredCurrencies = new Set<String>{ 'USD' };
Set<String> filteredRecognitionStreams = new Set<String>{ 'fferpcore__BillingDocument__c' };

ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters();
filters.setCompanies(filteredCompanies);
filters.setCurrencies(filteredCurrencies);
filters.setRecognitionStreams(filteredRecognitionStreams);

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess, summarizeTransactions);
//Specify filters to apply to each of the automation processes.
config.filter = filters;

// call the run processes method to chain the configured processes together and set the first one running.
ffrr.RevenueScheduleAutomationService.AutomationResult result = ffrr.RevenueScheduleAutomationService.runProcesses(config);

runProcesses

global static ffrr.RevenueScheduleAutomationService.AutomationResult runProcesses(Id configId)

Runs the recognition schedule processes specified by the AutomationConfiguration__c object with ID configId.

Input Parameters

Name Type Description
configId Id Id of the AutomationConfiguration__c object

Exceptions Thrown

Value Description
ffrr.Exceptions.IllegalStateException If a Recognition Schedule process ie Synchronize, Delete, Generate or Recognize is currently running then the system will throw an exception.
ffrr.Exceptions.AppException If the passed ID does not reference an existing AutomationConfiguration__c record.

Return Value

Returns a ffrr.RS_AutomationService.AutomationResult object.

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.

//Get the Id of the AutomationConfiguration__c to run.
ffrr__AutomationConfiguration__c automationConfigurationToRun = [SELECT Id FROM ffrr__AutomationConfiguration__c WHERE Name = 'ConfigToRun' LIMIT 1];
Id automationConfigurationId = automationConfigurationToRun.Id;

//Call runProcesses with the Id to run the associated automation configuration.
ffrr.RevenueScheduleAutomationService.AutomationResult result = ffrr.RevenueScheduleAutomationService.runProcesses(automationConfigurationId);

saveConfiguration

global static ffrr.RevenueScheduleAutomationService.ConfigurationSaveResult saveConfiguration(ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails creationDetails)

Saves an automation configuration as specified by the AutomationConfigurationCreationDetails.

Input Parameters

Name Type Description
creationDetails ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails Object containing the AutomationConfig to save and the name it should be saved as.

Exceptions Thrown

Value Description
ffrr.Exceptions.InvalidArgumentException If the AutomationConfig included in the AutomationConfigurationCreationDetails is invalid. The AutomationConfig is invalid if: The first process is after the last process or nothing is passed to the configuration object for either parameter. The CreateJournals process is selected and the RT to Journal Integration is not setup and working. Both the first and last process are Summarize and summarizeTransactions is false. The Recognize process is selected and RecognitionConfig is not fully populated. The Recognize process is not selected and RecognitionConfig is not null.
ffrr.Exceptions.AppException If the automationConfigName included in the AutomationConfigurationCreationDetails is empty.

Return Value

Returns a ffrr.RS_AutomationService.ConfigurationSaveResult object.

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.

//Create the AutomationConfigurationCreationDetails object.
//This includes the AutomationConfig and the name that the automation configuration record should be saved with.
ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Summarize;
Boolean summarizeTransactions = true;
ffrr.RevenueScheduleAutomationService.AutomationConfig automationConfig = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess, summarizeTransactions);

ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails creationDetails = new ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails();
creationDetails.config = automationConfig;
creationDetails.automationConfigName = 'My Automation Config';

//Save the created automation configuration.
ffrr.RevenueScheduleAutomationService.ConfigurationSaveResult result = ffrr.RevenueScheduleAutomationService.saveConfiguration(creationDetails);

//The returned ConfigurationSaveResult includes the AutomationConfiguration__c record that has been saved.
ffrr__AutomationConfiguration__c savedAutomationConfiguration = result.config;

ffrr.RevenueScheduleAutomationService.AutomationConfig

global with sharing class AutomationConfig

Class used to pass configuration to automation API call.

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 which processes should be run, starting from startProcess, following the order of processes in the AutomationProcess enum until endProcess is reached (inclusive)
//In this example, Generate, Recognize and Summarize will be run in that order.
ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Summarize;

//Set if transactions should be summarized when Summarize is included in the processes to run.
//Additionally, if the CreateJournals process is included in the processes to run, sets if journals should be created from transaction summaries (if true) or from transaction lines (if false).
Boolean summarizeTransactions = true;
ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess, summarizeTransactions);

//Indicates if the email notifications should be sent after each individual process has completed
config.shouldSendEmailAtEndOfProcesses = false;

// For the Recognize process, configure the cutoff period for including schedule lines for recognition, and the period to commit recognized values into.
// In this example, schedule lines up to and including the previous period will be selected, and then recognized into the current period.
// By default, if the configuration includes the Recognize process, schedule lines up to and including the previous period will be selected, and recognized into the previous period.
ffrr.RevenueScheduleAutomationService.RecognitionConfig recognitionConfig = new ffrr.RevenueScheduleAutomationService.RecognitionConfig();
recognitionConfig.selectionPeriod = ffrr.RevenueScheduleAutomationService.PeriodToSelectUpTo.Previous;
recognitionConfig.recognitionPeriod = ffrr.RevenueScheduleAutomationService.PeriodToRecognizeInto.Current;
config.recognitionConfig = recognitionConfig;

Set<String> filteredCompanies = new Set<String>{ 'Company A' };
Set<String> filteredCurrencies = new Set<String>{ 'USD' };
Set<String> filteredRecognitionStreams = new Set<String>{ 'fferpcore__BillingDocument__c' };

ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters();
filters.setCompanies(filteredCompanies);
filters.setCurrencies(filteredCurrencies);
filters.setRecognitionStreams(filteredRecognitionStreams);

//Specify filters to apply to each of the automation processes.
config.filter = filters;

Properties

Name Type Description
firstProcess ffrr.RevenueScheduleAutomationService.AutomationProcess The first process to be run. All processes between this (inclusive) and the lastProcess (inclusive) will be run, following the order of processes in the AutomationProcess enum. e.g. if firstProcess = Generate and lastProcess = Summarize, then Generate, Recognize and Summarize will be run in that order.
lastProcess ffrr.RevenueScheduleAutomationService.AutomationProcess The last process to be run. All processes between firstProcess (inclusive) and this (inclusive) will be run, following the order of processes in the AutomationProcess enum. e.g. if firstProcess = Generate and lastProcess = Summarize, then Generate, Recognize and Summarize will be run in that order.
summarizeTransactions Boolean Indicates if the summarization process should run when Summarize is included in the processes to run. If false, the summarization process will not run even when Summarize is included in the processes to run. This allows running processes before and after Summarize together in one API call while skipping the summarization process itself. Note: If Summarize is the only process selected to run and this option is set to false, an exception will be thrown if an attempt is made to run a process with that AutomationConfig instance.
Also, when running the CreateJournals process (regardless of whether Summarize is included in the processes to run), indicates if journals should be created from transaction summaries (if true) or transaction lines (if false).
Defaults to true
shouldSendEmailAtEndOfProcesses Boolean Indicates if email notifications should be sent after each individual process has completed. Note that with this option set to false, no email notifications will be sent at all as a result of the API call.
Defaults to true
filter ffrr.RevenueScheduleAutomationService.AutomationFilters An empty set means no filters will be applied. A set of companies containing an empty string will filter for records with no company. By applying a company filter, only records with a company that matches one of the items in the set are included in the AutomationService run. If you apply both company and currency filters, only records that match an item in both sets are included in the AutomationService run.
Defaults to no filters.
recognitionConfig ffrr.RevenueScheduleAutomationService.RecognitionConfig Defines behavior specific to the Recognize process. This configuration should not be set if the Recognize process is not included in the processes being run.

Methods

AutomationConfig

global AutomationConfig(ffrr.RevenueScheduleAutomationService.AutomationProcess firstProcess, ffrr.RevenueScheduleAutomationService.AutomationProcess lastProcess)

AutomationConfig

global AutomationConfig(ffrr.RevenueScheduleAutomationService.AutomationProcess firstProcess, ffrr.RevenueScheduleAutomationService.AutomationProcess lastProcess, Boolean summarizeTransactions)

ffrr.RevenueScheduleAutomationService.RecognitionConfig

global with sharing class RecognitionConfig

DTO used to pass configuration specific to the Recognize process as part of a ffrr.RevenueScheduleAutomationService API call.

Properties

Name Type Description
selectionPeriod ffrr.RevenueScheduleAutomationService.PeriodToSelectUpTo Controls the cutoff period for including schedule lines for recognition.
recognitionPeriod ffrr.RevenueScheduleAutomationService.PeriodToRecognizeInto Controls the period to commit recognized values into.

Methods

RecognitionConfig

global RecognitionConfig()

ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails

global inherited sharing class AutomationConfigurationCreationDetails

DTO used to request the creation of a new AutomationConfiguration__c record via the API.

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.

//Create the AutomationConfig object to save.
ffrr.RevenueScheduleAutomationService.AutomationProcess startProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess endProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Summarize;
Boolean summarizeTransactions = true;
ffrr.RevenueScheduleAutomationService.AutomationConfig automationConfig = new ffrr.RevenueScheduleAutomationService.AutomationConfig(startProcess, endProcess, summarizeTransactions);

//Create the AutomationConfigurationCreationDetails object.
//This includes the AutomationConfig created above, and the name that the automation configuration record should be saved with.
ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails creationDetails = new ffrr.RevenueScheduleAutomationService.AutomationConfigurationCreationDetails();
creationDetails.config = automationConfig;
creationDetails.automationConfigName = 'My Automation Config';

Properties

Name Type Description
config ffrr.RevenueScheduleAutomationService.AutomationConfig An instance of an AutomationConfig which represents the criteria for the creation of the AutomationConfiguration__c record and its AutomationConfigurationFilter__c records.
automationConfigName String The name the automation configuration record should be saved with.

Methods

AutomationConfigurationCreationDetails

global AutomationConfigurationCreationDetails()

ffrr.RevenueScheduleAutomationService.AutomationResult

global with sharing class AutomationResult

Class used to return results of automation API call.

Properties

Name Type Description
backgroundProcess ffrr__RevenueManagementBackgroundProcess__c The RevenueManagementBackgroundProcess__c which tracks the process which has been started by the API call.

ffrr.RevenueScheduleAutomationService.ConfigurationSaveResult

global with sharing class ConfigurationSaveResult

Class used to return the results of saving a new AutomationConfiguration__c via an API call.

Properties

Name Type Description
config ffrr__AutomationConfiguration__c The resulting AutomationConfiguration__c object which was saved.

ffrr.RevenueScheduleAutomationService.AutomationFilters

global inherited sharing class AutomationFilters extends ProcessFilters

Class used to store the filters to be applied to an automation process. A filter is a set of permitted values for a specified field.

This class contains deprecated items.

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.

//example 1 - Filter has a company, currency and recognition stream
//Specify companies to filter on.
Set<String> filteredCompanies = new Set<String>{ 'Company A' };

//Specify currencies to filter on.
Set<String> filteredCurrencies = new Set<String>{ 'USD' };

//Specify recognition streams to filter on.
Set<String> filteredRecognitionStreams = new Set<String>{ 'fferpcore__BillingDocument__c' };

//Create filters object containing the companies and currencies to filter on.
ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters();
filters.setCompanies(filteredCompanies);
filters.setCurrencies(filteredCurrencies);
filters.setRecognitionStreams(filteredRecognitionStreams);

//example 2 - Filter has only a single company and a single recognition stream
//Specify companies to filter on.
Set<String> filteredCompanies = new Set<String>{ 'Company A' };

//Specify null, or an empty set of type String, to provide no filter.
Set<String> filteredCurrencies = new Set<String>(); // Alternatively, Set<String> filteredCurrencies = null;

//Specify recognition streams to filter on.
Set<String> filteredRecognitionStreams = new Set<String>{ 'fferpcore__BillingDocument__c' };

//Create filters object containing the companies and currencies to filter on.
ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters();
filters.setCompanies(filteredCompanies);
filters.setCurrencies(filteredCurrencies);
filters.setRecognitionStreams(filteredRecognitionStreams);

//example 3 - Filter on records where no company is set
//Specify companies to filter on.
//Note: '' or null can be used to denote no company.
Set<String> filteredCompanies = new Set<String>{ null };

//Specify null, or an empty set of type String, to provide no filter.
Set<String> filteredCurrencies = new Set<String>(); // Alternatively, Set<String> filteredCurrencies = null;

//Specify recognition streams to filter on.
Set<String> filteredRecognitionStreams = new Set<String>{ 'fferpcore__BillingDocument__c' };

//Create filters object containing the companies and currencies to filter on.
ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters();
filters.setCompanies(filteredCompanies);
filters.setCurrencies(filteredCurrencies);
filters.setRecognitionStreams(filteredRecognitionStreams);

Methods

AutomationFilters

global AutomationFilters()

setCompanies

global void setCompanies(Set<String> companies)

Sets the companies to be filtered on. If no companies are set all companies are included.

Input Parameters

Name Type Description
companies Set<String> The names of companies to be filtered on.

setCurrencies

global void setCurrencies(Set<String> currencies)

Sets the currencies to be filtered on. If no currencies are set all currencies are included.

Input Parameters

Name Type Description
currencies Set<String> The currency codes to be filtered on.

setRecognitionStreams

global void setRecognitionStreams(Set<String> recognitionStreams)

Sets the recognition streams to be filtered on. If no recognition streams are set all recognition streams are included.

Input Parameters

Name Type Description
recognitionStreams Set<String> The recognition stream API names to be filtered on.

Deprecated

The following items are deprecated and not supported for use. We recommend that you stop using these items to avoid exceptions.

Methods

AutomationFilters

Deprecated:

global AutomationFilters(Set<String> filteredCompanies, Set<String> filteredCurrencies)

Construct a AutomationFilters object with the specified filters.

Input Parameters

Name Type Description
filteredCompanies Set<String> Set of companies to filter.
filteredCurrencies Set<String> Set of currencies to filter.
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.