Revenue Management API Developer Reference

ffrr.StagingTableService

global with sharing class StagingTableService

As of V3.3 this class has been replaced by ffrr.StagingService.

A new Staging prcoess has been introduced.

Enums

JobType

Indicates the type of revenue recognition batch job.

Value Description
Creating The batch job will create records.
Deleting The batch job will delete records.
Updating The batch job will update records.

JobStatus

Indicates the status of a revenue recognition batch job.

Value Description
Aborted The job was aborted by a user before it completed.
Completed The job has completed successfully.
Failed The job has failed.
Preparing The data is being prepared.
Processing The data is being processed.
Queued The job is ready to start.
Holding The job is waiting to enter the queue.

JobTransactionType

The type of transactions associated with the Batch Job.

Value Description
Actual The batch job is associated with Actual records.
Forecast The batch job is associated with Forecast records.
Manage The batch job is associated with the Manage Actual vs Forecast records.

Methods

abortStagingTableJob

global static void abortStagingTableJob(List<Id> idList)

Aborts one or more revenue recognition batch jobs. The supplied batch ids refer to the ids from the AsyncApexJob table rather than the Revenue Recognition job id.

Input Parameters

Name Type Description
idList List<Id> A list of one or more batch jobs.

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.

//Note: This sample demonstrates how to call the abortStagingTableJob method and 
//therefore relies on there being data within the system and jobs being in progress
//to be aborted.
List<ID> abortJobIDs = new List<ID>();

//Note: At this point the abortJobIDs list needs to be populated with the ID of one
//or more Revenue Recognition jobs that is to be aborted.

//Call the method
ffrr.StagingTableService.abortStagingTableJob(abortJobIDs);

getJob

global static ffrr.StagingTableService.Job getJob(Schema.Sobjecttype groupName)

Retrieves the last revenue recognition batch job for the specified group. The returned job will include details such as the type of job run, the status of the job and the number of records processed.

Input Parameters

Name Type Description
groupName Schema.Sobjecttype Name of the group.

Return Value

This service returns a ffrr.StagingTableService.Job 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.

//Note: This sample demonstrates how to call the getJob method and therefore relies
//on there being data and jobs within the system. While the sample will run without
//there being any data in the system, the output will, naturally, be different.

//Call the method
ffrr.StagingTableService.Job jobDetails = ffrr.StagingTableService.getJob(Opportunity.SObjectType);

//Output the job details
System.debug('jobDetails: ' + jobDetails);

getJob

global static ffrr.StagingTableService.Job getJob(Schema.Sobjecttype groupName, ffrr.StagingTableService.JobTransactionType transactionType)

Retrieves the last revenue recognition batch job for the specified group and transaction type. The returned job will include details such as the type of job run, the status of the job and the number of records processed.

Input Parameters

Name Type Description
groupName Schema.Sobjecttype The sobject type of the group (e.g. Project__c.SObjectType).
transactionType ffrr.StagingTableService.JobTransactionType The transaction type of the batch job (e.g. Actuals, Forecast).

Return Value

This service returns a ffrr.StagingTableService.Job 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.

//Note: This sample demonstrates how to call the getJob method and therefore relies 
//on there being data and jobs within the system. While the sample will run without
//there being any data in the system, the output will, naturally, be different.

//Call the method to get the Job
ffrr.StagingTableService.Job jobDetails = ffrr.StagingTableService.getJob(Opportunity.SObjectType, ffrr.StagingTableService.JobTransactionType.FORECAST);

//Output the job details
System.debug('jobDetails: ' + jobDetails);

ffrr.StagingTableService.Job

global class Job

Contains the details of a revenue recognition batch job.

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 Job
ffrr.StagingTableService.Job jSample = new ffrr.StagingTableService.Job();

//Specify the job's ID
jSample.ID = 'a0aa00000621d86';

//Specify what type of job this is
jSample.type = ffrr.StagingTableService.JobType.CREATING;

//Specify the job's status
jSample.status = ffrr.StagingTableService.JobStatus.ABORTED;

//Specify the date relating to the job type
jSample.lastDataCreation = date.newInstance(2013, 3, 31);
jSample.lastDataDeletion = null;
jSample.lastDataUpdated = null;

//Specify which group this job relates to, which recognition date was
//used and how many records were processed
jSample.groupName = Account.getSObjectType();
jSample.recognitionDate = date.newInstance(2013, 2, 28);
jSample.totalRecords = 5000;
jSample.processedRecords = 500;

Properties

Name Type Description
id Id ID of the batch job from the Asynx Apex Job table.
recognitionDate Date Date on which to base the revenue calculation.
lastDataCreation DateTime Date and time a Create job was last run.
lastDataUpdated DateTime Date and time an update job was last run.
lastDataDeletion DateTime Date and time a Delete job was last run.
groupName Schema.SObjectType Name of the group.
totalRecords Integer Total number of records to be processed.
processedRecords Integer Number of items processed.
type ffrr.StagingTableService.JobType The type of batch job.
transactionType ffrr.StagingTableService.JobTransactionType The type of the transactions associated with the Batch Job.
status ffrr.StagingTableService.JobStatus The status of the batch job.
errorMessage String Any error messages that are generated by the batch job.
© Copyright 2009–2017 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.