Revenue Management API Developer Reference

ffrr.RevenueContractService

global with sharing class RevenueContractService

Methods

populate

global static ffrr.RevenueContractService.PopulateResult populate(List<Id> contractIds)

Populates the fields on the Performance Obligation Line Items related to the specified Revenue Contracts based on their Field Mapping Definition. Field values on a Performance Obligation will also be updated from the Controlling Performance Obligation Line Item.

Input Parameters

Name Type Description
contractIds List<Id> The IDs of the Revenue Contract records that are related to the Performance Obligation Line Items to be populated.

Return Value

A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and the updated Performance obligations.

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 Contract Service is used to update existing
// Performance Obligation Line Item Records based on their Filed Mapping Definitions.

// Retrieve the Ids of the Revenue Contracts that will be updated.
List<ffrr__RevenueContract__c> contracts = [SELECT Id FROM ffrr__RevenueContract__c WHERE ffrr__AccountName__c = 'FF'];
List<Id> contractIds = new List<Id>();

for( ffrr__RevenueContract__c contract : contracts )
{
    contractIds.add(contract.Id);
}

// Get the result that contains the Ids of the Performance Obligation Line Items
// and Performance Obligations that have been updated successfully.
ffrr.RevenueContractService.PopulateResult result = ffrr.RevenueContractService.populate(contractIds);

populateFromControllingPoli

global static List<Id> populateFromControllingPoli(List<id> performanceObligationIds)

Populates the Performance Obligation with the values from the controlling Performance Obligation Line Item. If the controlling Performance Obligation Line Item is not set, the first one based on the Name order will be used.

Input Parameters

Name Type Description
performanceObligationIds List<id> The IDs of the Performance Obligations to be populated.

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 Contract Service is used to populate existing
// Performance Obligation records with the values from their controlling
// Performance Obligation Line Item.

// Get the Ids of all the Performance Obligations under a specific contract.
Id contractId = [Select Id from ffrr__RevenueContract__c WHERE ffrr__Description__c = 'FF Contract' LIMIT 1].Id;
List<ffrr__PerformanceObligation__c> performanceObligations = [Select Id from ffrr__PerformanceObligation__c WHERE ffrr__RevenueContract__c = :contractId ];

List<Id> performanceObligationIds = new List<Id>();
for( ffrr__PerformanceObligation__c performanceObligation : performanceObligations )
{
    performanceObligationIds.add( performanceObligation.Id );
}

// Populate the Performance Obligations based on their controlling 
// Performance Obligation Line Item.
List<Id> updatedPerformanceObligations = ffrr.RevenueContractService.populateFromControllingPoli( performanceObligationIds );

populateFromControllingPoliFromContract

global static List<Id> populateFromControllingPoliFromContract(List<Id> contractIds)

Populates the Performance Obligations for the specified Revenue Contracts with the values from the controlling Performance Obligation Line Items. If the controlling Performance Obligation Line Item is not set, the first one based on the Name order will be used.

Input Parameters

Name Type Description
contractIds List<Id> The IDs of the Performance Obligations to be populated.

populateFromSourceRecords

global static ffrr.RevenueContractService.PopulateResult populateFromSourceRecords(ffrr.RevenueContractService.PopulateContext context)

Will update the Performance Obligation Line Items that can be found linking to the given source records, and in turn the Performance Obligation from the controlling Performance Obligation Line Item.
NB This uses a noticeable amount of SOQL queries, and as such should not be used where a trigger may be handling more than 1000 records. CPU time, which must be 'shared' with the calling process, may reduce that further in practice.
This currently requires both sharing and CRUD access to the Performance Obligation Line Items and Performance Obligation as well as the ability to read Settings and FieldMappings.

Input Parameters

Name Type Description
context ffrr.RevenueContractService.PopulateContext A RevenueContractService.PopulateContext object containing the source IDs to repopulate from.

Return Value

A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and any updated Performance obligations.

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 Contract Service is used to update
// any existing Performance Obligation Line Items based on the source records
// which in this case are assumed to be the Opportunities (from an Opportunity trigger).


trigger UpdatePOLI on Opportunity (after update) 
{
    ffrr.RevenueContractService.PopulateContext context = new ffrr.RevenueContractService.PopulateContext();

    for(SObject obj: Trigger.New)
    {
        context.SourceRecordIDs.add(obj.ID);
    }

    ffrr.RevenueContractService.populateFromSourceRecords( context );
}

populateFromSourceRecordsAsync

global static ID populateFromSourceRecordsAsync(ffrr.RevenueContractService.PopulateContext context)

This will start a queuable job to update Performance Obligation Line Items based on the source records indicated. The work done will be the same as populateFromSourceRecords, except that it happens via a queuable. The aysnc nature does mean that triggers that call this will not see any errors that occur during the populate.

Input Parameters

Name Type Description
context ffrr.RevenueContractService.PopulateContext A RevenueContractService.PopulateContext object containing the source IDs to repopulate from.

Return Value

The id of the queued 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.

// In this example the Revenue Contract Service is used to update
// any existing Performance Obligation Line Items based on the source records
// which in this case are assumed to be the Opportunities (from an Opportunity trigger).
// Calling the Async version will set off a queuable job to do the work, so the
// trigger is not affected by the update, but neither can it react to any failures to
// update the Performance Obligation Line Items.


trigger UpdatePOLI on Opportunity (after update) 
{
    ffrr.RevenueContractService.PopulateContext context = new ffrr.RevenueContractService.PopulateContext();

    for(SObject obj: Trigger.New)
    {
        context.SourceRecordIDs.add(obj.ID);
    }

    ffrr.RevenueContractService.populateFromSourceRecordsAsync( context );
}

populatePerformanceObligationLineItems

global static ffrr.RevenueContractService.PopulateResult populatePerformanceObligationLineItems(List<Id> performanceObligationLineItemIds)

Populates the fields of the specified Performance Obligation Line Items based on their Field Mapping Definition. If one of the specified Performance Obligation Line Items is the controlling one, then the parent Performance Obligation is updated too.

Input Parameters

Name Type Description
performanceObligationLineItemIds List<Id> The IDs of the Performance Obligation Line Items to be populated.

Return Value

A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and any updated Performance obligations.

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 Contract Service is used to update existing
// Performance Obligation Line Item Records based on their Filed Mapping Definitions.

// Retrieve the Ids of the Performance Obligation Line Items that will be updated.
List<ffrr__PerformanceObligationLineItem__c> lineItems = [SELECT Id FROM ffrr__PerformanceObligationLineItem__c WHERE ffrr__AccountName__c = 'FF'];
List<Id> lineItemIds = new List<Id>();

for( ffrr__PerformanceObligationLineItem__c lineItem : lineItems )
{
    lineItemIds.add(lineItem.Id);
}

// Get the result that contains the Ids of the Performance Obligation Line Items
// and Performance Obligations that have been updated successfully.
ffrr.RevenueContractService.PopulateResult result = ffrr.RevenueContractService.populatePerformanceObligationLineItems(lineItemIds);

populateRelatedPerformanceObligationLineItems

global static ffrr.RevenueContractService.PopulateResult populateRelatedPerformanceObligationLineItems(List<Id> performanceObligationIds)

Populates the fields on the Performance Obligation Line Items related to the specified Performance Obligations based on their Field Mapping Definition. Field values on a Performance Obligation will also be updated from the Controlling Performance Obligation Line Item.

Input Parameters

Name Type Description
performanceObligationIds List<Id> The IDs of the Performance Obligation records that are related to the Performance Obligation Line Items to be populated.

Return Value

A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and the updated Performance obligations.

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 Contract Service is used to update the related
// Performance Obligation Line Item Records, of the provided Performance Obligations, 
// based on their Filed Mapping Definitions.

// Retrieve the Ids of the Performance Obligations.
List<ffrr__PerformanceObligation__c> obligations = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
List<Id> obligationIds = new List<Id>();

for( ffrr__PerformanceObligation__c obligation : obligations )
{
    obligationIds.add(obligation.Id);
}

// Get the result that contains the Ids of the Performance Obligation Line Items
// and Performance Obligations that have been updated successfully.
ffrr.RevenueContractService.PopulateResult result = ffrr.RevenueContractService.populateRelatedPerformanceObligationLineItems(obligationIds);

reallocate

global static void reallocate(List<Id> contractIds)

Calculates the Allocated Revenue for the Performance Obligation records related to the Revenue Contracts provided.

Input Parameters

Name Type Description
contractIds List<Id> The list of Revenue Contract IDs.

retrieve

global static List<ffrr.RevenueContractService.RevenueContract> retrieve(List<Id> contractIds)

Retrieves a list of RevenueContract records based on their IDs.

Input Parameters

Name Type Description
contractIds List<Id> A list of the IDs of RevenueContracts to retrieve.

Return Value

A list of RevenueContract objects

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 Contract Service is used to retrieve existing
// Revenue Contracts and their related Performance Obligations.

// Create The Contracts and Performance Obligations to be returned.
// Create a Revenue Contract.
ffrr__RevenueContract__c contract = new ffrr__RevenueContract__c();
contract.ffrr__Description__c = 'Description';
insert contract;

// Create Performance Obligations.
ffrr__PerformanceObligation__c po1 = new ffrr__PerformanceObligation__c();
po1.ffrr__RevenueContract__c = contract.id;
po1.ffrr__Description__c = 'PO 1';

ffrr__PerformanceObligation__c po2 = new ffrr__PerformanceObligation__c();
po2.ffrr__RevenueContract__c = contract.id;
po2.ffrr__Description__c = 'PO 2';

insert new List<ffrr__PerformanceObligation__c> {po1, po2};

// Call the Service passing the Contract Id as a list.
List<ffrr.RevenueContractService.RevenueContract> result = ffrr.RevenueContractService.retrieve(new List<Id>{contract.Id});

// Get the Revenue Contract.
ffrr.RevenueContractService.RevenueContract returnedContract = result[0];

// Get the Performance Obligations for this Revenue Contract. Size should be 2.
List<ffrr.RevenueContractService.PerformanceObligation> performanceObligations = returnedContract.PerformanceObligations;

retrieve

global static List<ffrr.RevenueContractService.RevenueContract> retrieve(List<Id> contractIds, ffrr.RevenueContractService.RetrieveOptions options)

Retrieves a list of RevenueContract records based on their IDs.

Input Parameters

Name Type Description
contractIds List<Id> A list of the IDs of RevenueContracts to retrieve.
options ffrr.RevenueContractService.RetrieveOptions A RetrieveOptions object which specifies additional retrieve options

Return Value

A list of RevenueContract objects with list of Performance Obligations populated.

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 Contract Service is used to retrieve existing
// Revenue Contracts without their related Performance Obligations.

// Create The Contracts and Performance Obligations to be returned.
// Create a Revenue Contract.
ffrr__RevenueContract__c contract = new ffrr__RevenueContract__c();
contract.ffrr__Description__c = 'Description';
insert contract;

// Create Performance Obligations.
ffrr__PerformanceObligation__c po1 = new ffrr__PerformanceObligation__c();
po1.ffrr__RevenueContract__c = contract.id;
po1.ffrr__Description__c = 'PO 1';

ffrr__PerformanceObligation__c po2 = new ffrr__PerformanceObligation__c();
po2.ffrr__RevenueContract__c = contract.id;
po2.ffrr__Description__c = 'PO 2';

insert new List<ffrr__PerformanceObligation__c> {po1, po2};

// Create a new instance of RetrieveOptions.
ffrr.RevenueContractService.RetrieveOptions options = new ffrr.RevenueContractService.RetrieveOptions();

// Do not query for Performance Obligations.
options.IncludePerformanceObligations = false;

// Call the Service passing the Contract Id as a list.
List<ffrr.RevenueContractService.RevenueContract> result = ffrr.RevenueContractService.retrieve(new List<Id>{contract.Id}, options);

// Get the Revenue Contract.
ffrr.RevenueContractService.RevenueContract returnedContract = result[0];

// Get the Performance Obligations for this Revenue Contract. Size should be 2.
List<ffrr.RevenueContractService.PerformanceObligation> performanceObligations = returnedContract.PerformanceObligations;

retrievePerformanceObligations

global static Map<Id, List<ffrr.RevenueContractService.PerformanceObligation>> retrievePerformanceObligations(List<Id> contractIds)

Retrieves the Performance Obligation records related to the Revenue Contracts provided.

Input Parameters

Name Type Description
contractIds List<Id> The list of Revenue Contract IDs.

Return Value

Map of ffrr.RevenueContractService.PerformanceObligation by the ffrr__RevenueContract__c ID.

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 a Revenue Contract.
ffrr__RevenueContract__c contract = new ffrr__RevenueContract__c();
contract.ffrr__Description__c = 'Description';
insert contract;

// Create Performance Obligations.
ffrr__PerformanceObligation__c po1 = new ffrr__PerformanceObligation__c();
po1.ffrr__RevenueContract__c = contract.id;
po1.ffrr__Description__c = 'PO 1';

ffrr__PerformanceObligation__c po2 = new ffrr__PerformanceObligation__c();
po2.ffrr__RevenueContract__c = contract.id;
po2.ffrr__Description__c = 'PO 2';

insert new List<ffrr__PerformanceObligation__c> {po1, po2};

// Call the Service.
Map<Id, List<ffrr.RevenueContractService.PerformanceObligation>> result = ffrr.RevenueContractService.retrievePerformanceObligations(new List<Id>{contract.Id});

savePerformanceObligations

global static ffrr.RevenueContractService.POSaveResult savePerformanceObligations(ffrr.RevenueContractService.POSaveContext saveContext)

Creates or updates Performance Obligations using the information provided.

Input Parameters

Name Type Description
saveContext ffrr.RevenueContractService.POSaveContext The save context containing the list of Performance Obligation records to be upserted, and records to be deleted.

Return Value

A POSaveResult containing the list of new and updated Performance Obligations and a POLISaveResult containing the list of new and updated Performance Obligations Line 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.

// In this example the Revenue Contract Service is used to create and update Performance Obligations, and to create and update Performance Obligation Line Items.

/**
 * This section contains data setup.
 */

// Create the Revenue Contract.
ffrr__RevenueContract__c contract = new ffrr__RevenueContract__c();
insert contract;

// Create a Performance Obligation for the newly created Revenue Contract.
ffrr__PerformanceObligation__c performanceObligation = new ffrr__PerformanceObligation__c(
    ffrr__RevenueContract__c = contract.Id,
    ffrr__SSPOverride__c = 100
);
insert performanceObligation;

// Create a Performance Obligation Line Item for the newly created Performance Obligation.
ffrr__PerformanceObligationLineItem__c performanceObligationLineItem = new ffrr__PerformanceObligationLineItem__c(
    ffrr__PerformanceObligation__c = performanceObligation.Id,
    ffrr__AccountName__c = 'POLI Account Name'
);
insert performanceObligationLineItem;

// Set the new Line Item to be the Controlling POLI on the Performance Obligation.
performanceObligation.ffrr__ControllingPOLI__c = performanceObligationLineItem.Id;
update performanceObligation;

/**
 * End of data setup.
 */

/**
 * This section shows how to retrieve the records for manipulation, modify them, create new records, and save the changes.
 */

// Retrieve the Performance Obligations. These will also retrieve the Performance Obligation Line Items as a list property on the Performance Obligation.
List<Id> contractIds = new List<Id>{contract.Id};
Map<Id, List<ffrr.RevenueContractService.PerformanceObligation>> performanceObligationsByContractId = ffrr.RevenueContractService.retrievePerformanceObligations(contractIds);

// Update the SSP Override to 200.
List<ffrr.RevenueContractService.PerformanceObligation> performanceObligations = performanceObligationsByContractId.get(contract.Id);
ffrr.RevenueContractService.PerformanceObligation existingObligation = performanceObligations[0];
existingObligation.SSPOverride = 200;

// Create a new Performance Obligation Line Item and set the Account Name.
ffrr.RevenueContractService.PerformanceObligationLineItem newLineItemForExistingPO = new ffrr.RevenueContractService.PerformanceObligationLineItem();
newLineItemForExistingPO.AccountName = 'Example Account';

// Set the Controlling POLI on the new Line Item. This will cause the Controlling POLI to be updated to this Line Item.
// Setting 'IsControllingPOLI' on two or more Line Items belonging to the same Performance Obligation will result in an ffrr.Exceptions.AppException being thrown.
// Leaving 'IsControllingPOLI' set to NULL on all POLIs passed in will not change the Controlling POLI.
newLineItemForExistingPO.IsControllingPOLI = TRUE;
existingObligation.PerformanceObligationLineItems[0].IsControllingPOLI = FALSE;

// Add the new Line Item to the existing Performance Obligation.
existingObligation.PerformanceObligationLineItems.add(newLineItemForExistingPO);

// Create a new Performance Obligation.
ffrr.RevenueContractService.PerformanceObligation newObligation = new ffrr.RevenueContractService.PerformanceObligation();
newObligation.ContractId = contract.Id;
newObligation.SSPOverride = 300;

// Create a new Performance Obligation Line Item and set the Account Name.
ffrr.RevenueContractService.PerformanceObligationLineItem newLineItemForNewPO = new ffrr.RevenueContractService.PerformanceObligationLineItem();
newLineItemForNewPO.AccountName = 'New Example Account';

// Set the Controlling POLI on the new Line Item. This will cause the Controlling POLI to be updated to this Line Item.
// Setting 'IsControllingPOLI' on two or more Line Items belonging to the same Performance Obligation will result in an ffrr.Exceptions.AppException being thrown.
// Leaving 'IsControllingPOLI' set to NULL on all POLIs passed in will not change the Controlling POLI.
newLineItemForNewPO.IsControllingPOLI = TRUE;

// Create a new List of Line Items on the Performance Obligation containing the new Line Item.
newObligation.PerformanceObligationLineItems = new List<ffrr.RevenueContractService.PerformanceObligationLineItem>{newLineItemForNewPO};

// Add the new Performance Obligation to a list of Performance Obligations for saving.
List<ffrr.RevenueContractService.PerformanceObligation> newAndUpdatedPerformanceObligations = new List<ffrr.RevenueContractService.PerformanceObligation>{
    newObligation,
    existingObligation
};

ffrr.RevenueContractService.POSaveContext saveContext = new ffrr.RevenueContractService.POSaveContext();
saveContext.PerformanceObligations = newAndUpdatedPerformanceObligations;

// Save the new and updated Performance Obligations.
ffrr.RevenueContractService.POSaveResult result = ffrr.RevenueContractService.savePerformanceObligations(saveContext);

// Query the new Performance Obligations for use later on.
List<ffrr__PerformanceObligation__c> newPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.NewRecordIds];

// Query the updated Performance Obligations for use later on.
List<ffrr__PerformanceObligation__c> updatedPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.UpdatedRecordIds];

// Query all the new and updated Performance Obligations for use later on.
List<ffrr__PerformanceObligation__c> allPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.AllRecordIds];

searchRecords

global static Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> searchRecords(String searchTerm)

Searches for Records that are related to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE, that start with the search term in their Name Field. Maximum of 100 records for each SObject Type will be returned by default. Wildcards are supported.

Input Parameters

Name Type Description
searchTerm String The text to search for.

Return Value

A List of the records found keyed by their SObject Type.

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 Contract Service is used to search for source records that are related
// to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE.

// Specify the term that matches the names of the source records.
// This will return any source record that starts with "Project" or "project".
String searchTerm = 'Project';

// Get the references of the source records, keyed by their type, matching the search term from the result.
Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> result = ffrr.RevenueContractService.searchRecords( searchTerm );

searchRecords

global static Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> searchRecords(String searchTerm, ffrr.RevenueContractService.RecordSearchOptions options)

Searches for Records that are related to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE, that start with the search term in their Name Field. Wildcards are supported.

Input Parameters

Name Type Description
searchTerm String The text to search for.
options ffrr.RevenueContractService.RecordSearchOptions Enables you to set options related to searching.

Return Value

A List of the records found keyed by their SObject Type.

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 Contract Service is used to search for source records that are related
// to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE.
// Additionally, a limit is used to reduce the number of results.

// Specify the term that matches the names of the source records.
// This will return any source record that starts with "Project" or "project".
String searchTerm = 'Project';

// Specify the maximum number of rows to be returned from the search operation.
ffrr.RevenueContractService.RecordSearchOptions options = new ffrr.RevenueContractService.RecordSearchOptions();
options.NumberOfRows = 10;

// Get the references of the first 10 source records, keyed by their type, matching the search term from the result.
Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> result = ffrr.RevenueContractService.searchRecords( searchTerm );

searchRecords

global static Set<ffrr.RevenueContractService.SourceReference> searchRecords(String searchTerm, String objectName, List<String> filterPath, String currCode, ffrr.RevenueContractService.RecordSearchOptions options)

Searches for Records that are related to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE and which are not associated with an existing Performance Obligation.

Input Parameters

Name Type Description
searchTerm String The text to search for (wildcards of '*' and '?' are supported).
objectName String The API name of the type of source object to search for (or '*' for all types).
filterPath List<String> The path (via lookups) to the field to search against (with the 'searchTerm') - this only applies with an 'objectname' to specify the starting point (otherwise the objects name field will be used).
currCode String The currency of the records we are searching for.
options ffrr.RevenueContractService.RecordSearchOptions Enables you to set options related to searching (e.g. 'NumberOfRows' to limit the number of rows returned).

Return Value

Information about the records found.

searchTemplates

global static List<ffrr.ViewService.Reference> searchTemplates(String searchTerm)

Searches for ffrr__Template__c records by name, whose related setting has an ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false. Returns 100 results by default.

Input Parameters

Name Type Description
searchTerm String The text to search for.

Return Value

A List of ViewService.Reference containing the Id and the name of matching results.

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 Service is used to search for templates, whose related Setting has an 
// ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false.

// Specify the term that matches the names of the templates.
// This will return any template that contains "Percent Complete"
String searchTerm = 'Percent Complete';

// Get the references of the templates matching the search term from the result.
List<ffrr.ViewService.Reference> result = ffrr.RevenueContractService.searchTemplates( searchTerm );

searchTemplates

global static List<ffrr.ViewService.Reference> searchTemplates(String searchTerm, ffrr.RevenueContractService.RecordSearchOptions options)

Searches for ffrr__Template__c records by name, whose related setting has an ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false.

Input Parameters

Name Type Description
searchTerm String The text to search for.
options ffrr.RevenueContractService.RecordSearchOptions Enables you to set options related to searching for templates.

Return Value

A List of ViewService.Reference containing the Id and the name of matching results.

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 Service is used to search for templates, whose related Setting has an 
// ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false.
// Additionally, a limit is used to reduce the number of results.

// Specify the term that matches the names of the templates.
// This will return any template that contains "Deliverable"
String searchTerm = 'Deliverable';

// Specify the maximum number of rows to be returned from the search operation.
ffrr.RevenueContractService.RecordSearchOptions options = new ffrr.RevenueContractService.RecordSearchOptions();
options.NumberOfRows = 10;

// Get the references of the first 10 templates matching the search term from the result.
List<ffrr.ViewService.Reference> result = ffrr.RevenueContractService.searchTemplates( searchTerm );

getSourceObjectInfo

global static Map<String, String> getSourceObjectInfo()

Searches for all the settings where ffrr__UseInRevenueContract__c is TRUE and which have a template.

Return Value

A map keyed by all the source objects in the selected settings with the object label as the map value.

transferPreviouslyRecognized

global static List<ffrr.RevenueContractService.TransferResult> transferPreviouslyRecognized(ffrr.RevenueContractService.TransferContext context)

Creates In Progress Revenue Recognition Transactions with Transaction Lines for Performance Obligation Line records provided that are related to source records with committed Transactions. Transaction Lines are only created for active Performance Obligations with valid templates.

Input Parameters

Name Type Description
context ffrr.RevenueContractService.TransferContext Specifies wich records will be included in the process as well as the information that will be put on the created Transactions.

Return Value

The List of the created Revenue Recognition Transaction IDs.

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 Contract Service is used to create Revenue Recognition Transactions
// for specific Performance Obligation records that are related to source records with committed Transactions.

// Select the Performance Obligation Line Items related to the source records. Any "Committed" Revenue, no later than the cutoff date,
// will be taken into account from this proccess.

// The following selects the Performance Obligation Line Items whose related contract's start date is after the 2017-01-01.
Date startOf2017 = Date.newInstance(2017, 01, 01);
List<ffrr__PerformanceObligationLineItem__c> lineItems = [SELECT Id FROM ffrr__PerformanceObligationLineItem__c WHERE ffrr__PerformanceObligation__r.ffrr__RevenueContract__r.ffrr__StartDate__c >= :startOf2017];
List<Id> lineItemIds = new List<Id>();
for( ffrr__PerformanceObligationLineItem__c lineItem : lineItems )
{
    lineItemIds.add(lineItem.Id);
}

// Create the Transfer Context.
ffrr.RevenueContractService.TransferContext context = new ffrr.RevenueContractService.TransferContext();

context.RecognitionDate = Date.newInstance(2017, 1, 1);
context.CutoffDate = Date.newInstance(2016, 12, 31);
context.Description = 'Previously recognized before 2017';
context.LegislationType = 'ASC 605';
context.Period = [SELECT Id FROM ffrr__RecognitionPeriod__c WHERE Name = '2017/001' LIMIT 1].Id;

// Set the Performance Obligation Line Item Ids to the context.
context.PerformanceObligationLineItems = lineItemIds;

// Retrieve the result containing the created Transactions.
List<ffrr.RevenueContractService.TransferResult> result = ffrr.RevenueContractService.transferPreviouslyRecognized(context);

transferPreviouslyRecognizedAsync

global static Id transferPreviouslyRecognizedAsync(ffrr.RevenueContractService.TransferContext context)

Creates In Progress Revenue Recognition Transactions with Transaction Lines for all Performance Obligation records that are related to source records with committed Transactions. Transaction Lines are only created for active Performance Obligations with valid templates.

Input Parameters

Name Type Description
context ffrr.RevenueContractService.TransferContext Specifies wich records will be included in the process as well as the information that will be put on the created Transactions.

Return Value

The ID of the AsyncApexJob.

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 Contract Service is used to create Revenue Recognition Transactions asynchronously
// for all the Performance Obligation records that are related to source records with committed Transactions.

ffrr.RevenueContractService.TransferContext context = new ffrr.RevenueContractService.TransferContext();
context.RecognitionDate = Date.newInstance(2016, 1, 1);
context.CutoffDate = Date.newInstance(2015, 12, 31);
context.Description = 'Previously recognized before 2016';
context.LegislationType = 'ASC 605';
context.Period = [SELECT Id FROM ffrr__RecognitionPeriod__c WHERE Name = '2017/001' LIMIT 1].Id;

// Retrieve the Id of the Batch Job that's been started.
Id resultingBatchId = ffrr.RevenueContractService.transferPreviouslyRecognizedAsync(context);

ffrr.RevenueContractService.DeleteContext

global abstract class DeleteContext

Base class that details Revenue Contracts and related records to be deleted

Properties

Name Type Description
ContractsToDelete List<Id> The Ids of the Revenue Contract records to be deleted
PerformanceObligationsToDelete List<Id> The Ids of the Performance Obligation records to be deleted
POLIsToDelete List<Id> The Ids of the Performance Obligation Line Item records to be deleted

Methods

DeleteContext

global DeleteContext()

ffrr.RevenueContractService.Filter

global class Filter

The filter class used to specify field/value pairs when filtering on Revenue Contracts during the transfer previously recognized 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.

// Create a new text field Filter
ffrr.RevenueContractService.Filter textFilter = new ffrr.RevenueContractService.Filter();

// Set the field to filter on to be the Description__c field. This could be any text or lookup field.
textFilter.Field = ffrr__RevenueContract__c.ffrr__Description__c;

// Set the value to filter on.
textFilter.Value = 'Ready for Transfer';

// You can also create filters for Lookups and Booleans
ffrr.RevenueContractService.Filter booleanFilter = new ffrr.RevenueContractService.Filter();

// Set the field to filter on to be the Description__c field. This could be any text or lookup field.
booleanFilter.Field = ffrr__RevenueContract__c.ffrr__Active__c;

// Set the value to filter on.
booleanFilter.Value = 'true';

ffrr.RevenueContractService.Filter lookupFilter = new ffrr.RevenueContractService.Filter();

// Set the field to filter on to be the Description__c field. This could be any text or lookup field.
lookupFilter.Field = ffrr__RevenueContract__c.ffrr__Account__c;

// Set the value to filter on.
lookupFilter.Value = [SELECT Id FROM Account LIMIT 1].Id;

Properties

Name Type Description
Field Schema.SObjectField The field on the Revenue Contract on which to filter.
Value Object The value for the filter.

Methods

Filter

global Filter()

ffrr.RevenueContractService.PathItem

global class PathItem

Contains information about a step in the metadata chain.

Properties

Name Type Description
ItemLabel String The label of the SObject at this point in the path.
RecordName String The type of the SObject at this point in the path.

ffrr.RevenueContractService.PerformanceObligation

global class PerformanceObligation

Represents a Performance Obligation record

Properties

Name Type Description
Id Id The ID of the Performance Obligation
Name String The name of the Performance Obligation
AccountName String Information about the Performance Obligation. Often this will be the account name, but it can be any information.
Active Boolean Specifies whether the Performance Obligation is active
AllocatedRevenue Decimal The allocated revenue of the Performance Obligation
AllocatedRevenueOverride Decimal The allocated revenue override of the Performance Obligation
AmortizedToDate Decimal The amount amortized to date for this Performance Obligation.
BalanceSheet String The balance sheet name for the Performance Obligation
Complete Boolean Specifies whether the Performance Obligation is complete
ContractId Id The Revenue Contract of the Performance Obligation
Cost Decimal Cost for this Performance Obligation.
CostBalanceSheet String The name of the balance sheet GLA (cost) for this Performance Obligation.
CostCenter String The cost center name for the Performance Obligation
CostCostCenter String The cost center (cost) for this Performance Obligation.
CostIncomeStatement String The name of the income statement GLA (cost) for this Performance Obligation.
CurrencyIsoCode String The currency code of the Performance Obligation
Description String The description of the Performance Obligation
IncomeStatement String The income statement name for the Performance Obligation
PercentComplete Decimal The percentage the Performance Obligation is complete
PerformanceObligationLineItems List<ffrr.RevenueContractService.PerformanceObligationLineItem>
ReadyForRevRec Boolean Specifies whether the Performance Obligation is ready for revenue recognition
RecognizedToDate Decimal The recognized to date of the Performance Obligation
Revenue Decimal The revenue of the Performance Obligation
RevRecComplete Boolean Specifies whether the Performance Obligation is revenue recognition complete
SSP Decimal The SSP of the Performance Obligation
TotalSSP Decimal Sum of the SSPs for all Performance Obligation Line Items in the Performance Obligation.
SSPOverride Decimal The SSP override for the Performance Obligation
StartDate Date The start date of the Performance Obligation
EndDate Date The end date of the Performance Obligation
Template ffrr.ViewService.Reference The template of the Performance Obligation

Methods

PerformanceObligation

global PerformanceObligation()

ffrr.RevenueContractService.PerformanceObligationLineItem

global class PerformanceObligationLineItem

Represents a Performance Obligation Line Item record.

Properties

Name Type Description
Id Id The ID of the Performance Obligation Line Item.
Name String The name of the Performance Obligation Line Item.
AccountName String The reference for the Performance Obligation Line Item.
Active Boolean Indicates whether the Performance Obligation Line Item is active.
BalanceSheetAccount String The Balance Sheet GLA of the Performance Obligation Line Item.
Completed Boolean Indicates whether the Performance Obligation Line Item is complete.
Cost Decimal Cost for this Performance Obligation Line Item.
CostBalanceSheetAccount String Balance Sheet GLA (Cost)
CostCenterAccount String The Cost Center Account of the Performance Obligation Line Item.
CostCostCenterAccount String Cost Center (Cost)
CostIncomeStatementAccount String Income Statement GLA (Cost)
CurrencyIsoCode String The Currency of the Performance Obligation Line Item.
Description String The Description of the Performance Obligation Line Item.
FieldMapping ffrr.ViewService.Reference The Field Mapping Definition of the Performance Obligation Line Item. This determines which fields get populated from Source Records when "Update from Source" occurs.
IncomeStatementAccount String The Income Statement GLA of the Performance Obligation Line Item.
IsControllingCostPOLI Boolean Indicates whether the Performance Obligation Line Item is the Cost Controlling Performance Obligation Line Item. The Performance Obligation will take Cost specific vaues from the Cost Controlling Performance Obligation Line Item when "Update from Source" occurs. The cost controlling POLI will only be used to populate the more general fields on the Performance Obligation in the scenario whereby a controlling revenue POLI has not be specified at all.
IsControllingPOLI Boolean Indicates whether the Performance Obligation Line Item is the Revenue Controlling Performance Obligation Line Item. The Performance Obligation will take Revenue specific values from the Revenue Controlling Performance Obligation Line Item when "Update from Source" occurs. The revenue controlling POLI will get priority when populating the more general fields on the Performance Obligation.
PercentageComplete Decimal The Percentage that this Performance Obligation Line Item is complete, using the scale of 100 to denote 100%.
PerformanceObligationId Id The ID of the Performance Obligation this Performance Obligation Line Item belongs to.
Revenue Decimal The Revenue for the Performance Obligation Line Item.
SSP Decimal The SSP of the Performance Obligation Line Item.
SourceRecord ffrr.ViewService.Reference The Source Record linked to this Performance Obligation Line Item.
SourceRecordSetting ffrr.ViewService.Reference The Setting used by the Source Record related to this Performance Obligation Line Item.
StartDate Date The Start Date of the Performance Obligation Line Item.
EndDate Date The End Date of the Performance Obligation Line Item.
ValueType String The value-type from the source records settings.

Methods

PerformanceObligationLineItem

global PerformanceObligationLineItem()

ffrr.RevenueContractService.PopulateContext

global class PopulateContext

Object that wraps the IDs that are needed for the populateFromSourceRecords methods.

Properties

Name Type Description
SourceRecordIDs List<Id> The Ids of the Source Records that are to be used to find Performance Obligation Line Items that need updating from those source records.

Methods

PopulateContext

global PopulateContext()

ffrr.RevenueContractService.PopulateResult

global class PopulateResult

Contains information resulting from the populate operation.

Properties

Name Type Description
UpdatedPolis List<Id> The ids of the updated Performance Obligation Line Items.
UpdatedPos List<Id> The ids of the updated Performance Obligations.

ffrr.RevenueContractService.POLISaveResult

global class POLISaveResult extends SaveResult

This class extends ffrr.RevenueContractService.SaveResult

ffrr.RevenueContractService.POSaveContext

global class POSaveContext extends DeleteContext

Specifies information needed to save Performance Obligations

This class extends ffrr.RevenueContractService.DeleteContext

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.

// This example creates a new POSaveContext ready to be passed to the ffrr.RevenueContractService.savePerformanceObligations() method.

// Create a new POSaveContext.
ffrr.RevenueContractService.POSaveContext saveContext = new ffrr.RevenueContractService.POSaveContext();

// Pass in your list of Performance Obligations to update.
saveContext.PerformanceObligations = new List<ffrr.RevenueContractService.PerformanceObligation>();

/*
 * Pass in record IDs to delete.
 * The order in which records are deleted is as follows:
 * 1: ffrr__PerformanceObligationLineItem__c
 * 2: ffrr__PerformanceObligation__c
 * 3: ffrr__RevenueContract__c
 *
 * Deleting a Revenue Contract will delete all related Performance Obligations and Line Items,
 * and deleting a Performance Obligation will delete all related Line Items.
 */
// Pass in any Contract IDs you want to delete.
saveContext.ContractsToDelete = new List<Id>();

// Pass in any Performance Obligation IDs you want to delete.
saveContext.PerformanceObligationsToDelete = new List<Id>();

// Pass in any Performance Obligation Line Item IDs you want to delete.
saveContext.POLIsToDelete = new List<Id>();

Properties

Name Type Description
PerformanceObligations List<ffrr.RevenueContractService.PerformanceObligation> The list of Performance Obligation records to be upserted.

Methods

POSaveContext

global POSaveContext()

ffrr.RevenueContractService.POSaveResult

global class POSaveResult extends SaveResult

Contains the results of the Performance Obligation Save operation

This class extends ffrr.RevenueContractService.SaveResult

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.

// This list should be populated with RevenueContractService.PerformanceObligations,
// and each of those should contain a list of RevenueContractService.PerformanceObligationLineItems.
List<ffrr.RevenueContractService.PerformanceObligation> newAndUpdatedPerformanceObligations = new List<ffrr.RevenueContractService.PerformanceObligation>();

ffrr.RevenueContractService.POSaveContext saveContext = new ffrr.RevenueContractService.POSaveContext();
saveContext.PerformanceObligations = newAndUpdatedPerformanceObligations;

// Save the new and updated Performance Obligations.
ffrr.RevenueContractService.POSaveResult result = ffrr.RevenueContractService.savePerformanceObligations(saveContext);

// Query the new Performance Obligations.
List<ffrr__PerformanceObligation__c> newPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.NewRecordIds];

// Query the updated Performance Obligations.
List<ffrr__PerformanceObligation__c> updatedPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.UpdatedRecordIds];

// Query all the new and updated Performance Obligations.
List<ffrr__PerformanceObligation__c> allPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.AllRecordIds];

// Get the Line Item results.
ffrr.RevenueContractService.POLISaveResult lineItemResult = result.POLISaveResult;

// Query the new Performance Obligation Line Items.
List<ffrr__PerformanceObligationLineItem__c> newPerformanceObligationLineItems = [SELECT Id, ffrr__AccountName__c FROM ffrr__PerformanceObligationLineItem__c WHERE ID IN :lineItemResult.NewRecordIds];

// Query the updated Performance Obligation Line Items.
List<ffrr__PerformanceObligationLineItem__c> updatedPerformanceObligationLineItems = [SELECT Id, ffrr__AccountName__c FROM ffrr__PerformanceObligationLineItem__c WHERE ID IN :lineItemResult.UpdatedRecordIds];

// Query all the new and updated Performance Obligation Line Items.
List<ffrr__PerformanceObligationLineItem__c> allPerformanceObligationLineItems = [SELECT Id, ffrr__AccountName__c FROM ffrr__PerformanceObligationLineItem__c WHERE ID IN :lineItemResult.AllRecordIds];

Properties

Name Type Description
POLISaveResult ffrr.RevenueContractService.POLISaveResult

ffrr.RevenueContractService.RecordSearchOptions

global class RecordSearchOptions

Enables you to set options related to searching for 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.

// Use the Record Search Options to specify the maximum number of results
// to be returned from the Search Templates operation.
ffrr.RevenueContractService.RecordSearchOptions options = new ffrr.RevenueContractService.RecordSearchOptions();
options.NumberOfRows = 10;

Properties

Name Type Description
NumberOfRows Integer The maximum number of results to be returned

Methods

RecordSearchOptions

global RecordSearchOptions()

ffrr.RevenueContractService.RetrieveOptions

global class RetrieveOptions

Contains additional options related to retrieving RevenueContract instances

Properties

Name Type Description
IncludePerformanceObligations Boolean Specifies whether to retrieve PerformanceObligation instances along with their parent Revenue Contract. Defaults to true.

Methods

RetrieveOptions

global RetrieveOptions()

ffrr.RevenueContractService.RevenueContract

global class RevenueContract

Represents a Revenue Contract record

Properties

Name Type Description
Id Id The ID of the Revenue Contract
Name String The name of the Revenue Contract
AccountName String The reference for the Revenue Contract
Active Boolean Specifies whether the Revenue Contract is active
AllocationRatio Decimal The ratio used to allocate revenue to linked Performance Obligations
AllocationStatus String Shows if the Revenue for this contract has been fully allocated, or needs reallocating
CurrencyIsoCode String The currency code of the Revenue Contract
Description String The description of the Revenue Contract
PerformanceObligations List<ffrr.RevenueContractService.PerformanceObligation> All Performance Obligations related to this contract
PerformanceObligationsCount Decimal The number of Performance Obligations on this Contract
Revenue Decimal The value that will be allocated to the Performance Obligations. Uses Total Revenue, or Revenue Override if populated
RevenueAllocated Boolean Indicates if the Revenue for this contract has been allocated successfully
RevenueRecognitionComplete Boolean Indicates whether this Revenue Contract is complete
StartDate Date The start date of the Revenue Contract
EndDate Date The end date of this Revenue Contract
TotalAllocatedRevenue Decimal Total Allocated Revenue for this Revenue Contract
TotalAllocatedRevenueOverride Decimal Sum of Allocated Revenue Override values from all linked Performance Obligations
TotalAmortizedToDate Decimal Total Amortized To Date for this Revenue Contract
TotalCost Decimal Total cost for this Revenue Contract
TotalRecognizedToDate Decimal Total Recognized To Date for this Revenue Contract
TotalSSP Decimal Sum of Standalone Selling Prices from all linked Performance Obligations

Methods

RevenueContract

global RevenueContract()

ffrr.RevenueContractService.SaveResult

global abstract class SaveResult

Contains the results of the Save operation

Properties

Name Type Description
AllRecordIds List<Id> The IDs of both the created and updated records.
NewRecordIds List<Id> The IDs of created records.
UpdatedRecordIds List<Id> The IDs of updated records.

Methods

SaveResult

global SaveResult()

ffrr.RevenueContractService.SourceReference

global class SourceReference

Contains information about the records found from the Search process.

Properties

Name Type Description
Id String The Id of the source record this class contains information about.
AccountName String The account name of the source record.
Description String The description of the source record.
SelectPath List<ffrr.RevenueContractService.PathItem> The search path used to find this record.
SettingsPath List<ffrr.RevenueContractService.PathItem> The hierarchy of parent records leading to this source record.
ValueType String The value-type from the source records settings.

ffrr.RevenueContractService.TransferContext

global class TransferContext

@decription The context in which the Transfer Previously Recognized process will be executed.

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 a Transfer context to specify how the Transfer Previously Recognized process
// will be executed.

// Select the period the Recognition Transaction will be created for. 
Date recognitionDate = Date.newInstance(2016, 1, 1);

List<ffrr__RecognitionPeriod__c> periods = [SELECT Id FROM ffrr__RecognitionPeriod__c WHERE ffrr__StartDate__c <= :recognitionDate AND ffrr__EndDate__c >= :recognitionDate];

// Select an "In Progress" Transaction to Update.
List<ffrr__RevenueRecognitionTransaction__c> transactions = [SELECT Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__Status__c = 'In Progress' AND ffrr__Description__c = 'FinancialForce.com' LIMIT 1];
List<Id> transactionIds = new List<Id>();
for( ffrr__RevenueRecognitionTransaction__c trans : transactions )
{
    transactionIds.add(trans.Id);
}

// Select the Performance Obligation Line Items related to the source records. Any "Committed" Revenue to be used
// Recognition Transaction related to those source records will be taken into account from this proccess.
Date startOf2017 = Date.newInstance(2017, 01, 01);
List<ffrr__PerformanceObligationLineItem__c> lineItems = [SELECT Id FROM ffrr__PerformanceObligationLineItem__c WHERE ffrr__PerformanceObligation__r.ffrr__RevenueContract__r.ffrr__StartDate__c >= :startOf2017];
List<Id> lineItemIds = new List<Id>();
for( ffrr__PerformanceObligationLineItem__c lineItem : lineItems )
{
    lineItemIds.add(lineItem.Id);
}

// Create the Transfer Context.
ffrr.RevenueContractService.TransferContext context = new ffrr.RevenueContractService.TransferContext();

// Set the Performance Obligation Line Item Ids to the context.
context.PerformanceObligationLineItems = lineitemIds;

// Set the transction to be updated.
context.TransactionIds = transactionIds;

// Specify the Period that will be put on the Recognition Transactions
context.Period = periods[0].Id;

// Specify the Recognition Date and Description that will be on the Revenue Recognition Transactions
context.RecognitionDate = recognitionDate;
context.Description = 'Previously recognized before 2016';

// Specify the Cutoff Date that will be used to determine which Transactions will be used to transfer Previously Recognized.
context.CutoffDate = Date.newInstance(2015, 12, 31);

// Specify the legislation type for the Transactions that will be created.
context.LegislationType = 'ASC 605';

// Specify the filter to limit which Performance Obligation Line Items get selected.
// For this example we will filter where the Account.Name is 'FinancialForce'
ffrr.RevenueContractService.Filter filter = new ffrr.RevenueContractService.Filter();

// Set the field to filter on to be the Description__c field. This could be any text or lookup field.
filter.Field = ffrr__RevenueContract__c.ffrr__Account__c;

// Set the value to filter on.
filter.Value = [SELECT Id FROM Account WHERE Name = 'FinancialForce' LIMIT 1].Id;

context.RevenueContractFilters = new List<ffrr.RevenueContractService.Filter>{filter};

Properties

Name Type Description
CutoffDate Date Specifies the committed Revenue Recognition Transactions that will be used from the Transfer Process. Only committed Transactions where the Recognition Date is up to the cutoff date will be used.
Description String The description on the created transaction.
LegislationType String The legislation type on the created transaction.
PerformanceObligationLineItems List<Id> The Performance Obligation Lines related to source records with committed Transactions that will be used by the process. (Optional)
Period String The recognition period the transactions will be created for.
RecognitionDate Date The recognition date the transactions will be created for.
TransactionIds List<Id> Specifies transactions to be amended with Transaction Lines. (Optional) New Transaction Lines created from the Performance Obligation Line Items specified will be amended to the given Transactions of the same currency. The Transactions specified in this list must be of different currencies.
RevenueContractFilters List<ffrr.RevenueContractService.Filter> Specifies which Revenue Contracts are eligible for Transferring Previously Recognized by providing key-value pairs of filters.

Methods

TransferContext

global TransferContext()

ffrr.RevenueContractService.TransferResult

global class TransferResult

Properties

Name Type Description
ActiveTransaction Id
CurrencyCode String
GroupName String
TransactionIds List<Id>
error Exception
© Copyright 2009–2020 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.