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.

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 first process is after the last process or nothing is passed to the configuration object for either parameter an exception will be thrown. If the CreateJournals process is selected and the RT to Journal Integration is not setup and working the system will throw an exception. If both the first and last process are Summarize and summarizeTransactions is false the system throws an exception.
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

ffrr.RevenueScheduleAutomationService.AutomationProcess firstProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess lastProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.CreateJournals;

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(firstProcess, lastProcess);

// 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 firstProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;
ffrr.RevenueScheduleAutomationService.AutomationProcess lastProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Generate;

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(firstProcess, lastProcess);

// 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)

ffrr.RevenueScheduleAutomationService.AutomationProcess firstProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Recognize;
ffrr.RevenueScheduleAutomationService.AutomationProcess lastProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.CreateJournals;

Boolean summarizeTransactions = false;

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(firstProcess, lastProcess, summarizeTransactions);

// 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 firstProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.Recognize;
ffrr.RevenueScheduleAutomationService.AutomationProcess lastProcess = ffrr.RevenueScheduleAutomationService.AutomationProcess.CreateJournals;

Boolean summarizeTransactions = false;

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

ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters(
  filteredCompanies,
  filteredCurrencies
);

ffrr.RevenueScheduleAutomationService.AutomationConfig config = new ffrr.RevenueScheduleAutomationService.AutomationConfig(firstProcess, lastProcess, 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);

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

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

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

ffrr.RevenueScheduleAutomationService.AutomationFilters filters = new ffrr.RevenueScheduleAutomationService.AutomationFilters(
  filteredCompanies,
  filteredCurrencies
);

//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.

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.AutomationResult

global with sharing class AutomationResult

Class used to return results of automation API call.

Properties

Name Type Description
backgroundProcess ffrr__RevenueManagementBackgroundProcess__c

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.

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 and a currency
//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' };

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

//example 2 - Filter has only a single company
//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; 

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

//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; 

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

Methods

AutomationFilters

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–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.