Revenue Management API Developer Reference

ffrr.CalculationService

global with sharing class CalculationService

Enums

LineType

Indicates the type of revenue recognition display record.

Value Description
Detail A detail record.
Summary A summary record.

Methods

calculateDeliverable

global static ffrr.CalculationService.Calculation calculateDeliverable(Decimal totalRevenue, Decimal prevRecognized)

Calculates revenue for a Deliverable recognition method using the supplied total revenue and previously recognized values.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//Call the method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateDeliverable(2000.00, 250.00);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculateEqualSplit

global static ffrr.CalculationService.Calculation calculateEqualSplit(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)

Calculates revenue for an Equal Split recognition method and a calculation type of Months using the supplied values. The results are calculated on whole months.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.
startDate Date Start date of the item.
endDate Date End date of the item.
recognitionDate Date Date on which to base calculations.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);

//Call the method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateEqualSplit(1200.00, 50.00, startDate, endDate, recognitionDate);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculateEqualSplit445

global static ffrr.CalculationService.Calculation calculateEqualSplit445(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)

Calculates revenue for an Equal Split recognition method and a 445 calculation type using the supplied values. The results are calculated using the 445 recognition periods and years defined in the system.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.
startDate Date Start date of the item.
endDate Date End date of the item.
recognitionDate Date Date on which to base calculations.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.

//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);

//Actually call the calculateEqualSplit445 method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateEqualSplit445(1200.00, 50.00, startDate, endDate, recognitionDate);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculateEqualSplitDays

global static ffrr.CalculationService.Calculation calculateEqualSplitDays(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)

Calculates revenue for an Equal Split recognition method and a calculation type of Days using the supplied values. The results are calculated according to the number of days between the specified start and recognition dates and the mean value per day between the specified start and end dates.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.
startDate Date Start date of the item.
endDate Date End date of the item.
recognitionDate Date Date on which to base calculations.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.

//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);

//Call the method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateEqualSplitDays(1200.00, 50.00, startDate, endDate, recognitionDate);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculateEqualSplitMonthsPartPeriods

global static ffrr.CalculationService.Calculation calculateEqualSplitMonthsPartPeriods(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)

Calculates revenue for an Equal Split recognition method and a calculation type of Months/Part Periods using the supplied values. The results are calculated using both whole and part months/periods.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.
startDate Date Start date of the item.
endDate Date End date of the item.
recognitionDate Date Date on which to base calculations.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.

//Setup the dates involved
Date startDate = Date.newInstance(2013, 01, 01);
Date endDate = Date.newInstance(2013, 12, 31);
Date recognitionDate = Date.newInstance(2013, 01, 05);

//Actually call the calculateEqualSplitMonthsPartPeriods method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateEqualSplitMonthsPartPeriods(1200.00, 50.00, startDate, endDate, recognitionDate);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculateEqualSplitMonthsPartPeriodsWithProratedPartPeriods

global static ffrr.CalculationService.Calculation calculateEqualSplitMonthsPartPeriodsWithProratedPartPeriods(Decimal totalRevenue, Decimal prevRecognized, Date startDate, Date endDate, Date recognitionDate)

Calculates revenue for an Equal Split Months / Actual Days in Part Periods recognition method and a calculation type of Months / Actual Days in Part Periods using the supplied values. The results are calculated using both whole and part months/periods.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.
startDate Date Start date of the item.
endDate Date End date of the item.
recognitionDate Date Date on which to base calculations.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//This sample requires that Revenue Recognition years and periods exist within
//the system as, without them, calculations that rely on periods cannot be performed.

//Setup the dates involved
Date startDate = Date.newInstance(2021, 01, 16);
Date endDate = Date.newInstance(2021, 09, 05);
Date recognitionDate = Date.newInstance(2021, 01, 31);

//Actually call the calculateEqualSplitMonthsPartPeriodsWithProratedPartPeriods method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateEqualSplitMonthsPartPeriodsWithProratedPartPeriods(1000.00, 50.00, startDate, endDate, recognitionDate);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculatePercentageComplete

global static ffrr.CalculationService.Calculation calculatePercentageComplete(Decimal totalRevenue, Decimal prevRecognized, Decimal percentageComplete)

Calculates revenue for a % Complete recognition method using the supplied values. The results are calculated as a percentage of the total revenue.

Input Parameters

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
prevRecognized Decimal Revenue previously recognized.
percentageComplete Decimal Percentage of the item (for example, project or milestone) that is complete.

Return Value

This service returns a ffrr.CalculationService.Calculation 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.

//Call the method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculatePercentageComplete(1200.00, 50.00, 50.00);

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

calculateRevenue

global static ffrr.CalculationService.Calculation calculateRevenue(SObject record, Date recognitionDate, String currencyFilter)

Calculates revenue based on the template associated with the supplied record. The method will automatically extract the required values based on the record's template, determine the calculation type involved, validate any needed data and perform the calculation.

Input Parameters

Name Type Description
record SObject The item to calculate revenue for.
recognitionDate Date Date on which to base calculations.
currencyFilter String Currency ISO code to use in the calculation.

Return Value

This service returns a ffrr.CalculationService.Calculation 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 requires that a complete set of Recognition Settings, Recognition Templates, and Recognition
//Years and Periods (covering the year 2013) are available within the system. For the
//purposes of this example it is assumed that we are using an ffrr__PerformanceObligation__c record which is
//correctly connected to a valid Template. You can put any source record here.

//The item that we'll be calculating revenue for. You would use your SObject here.
SObject mySourceObject =
    [
        SELECT Id, Name, ffrr__ffrrTemplate__c, ffrr__StartDate__c, ffrr__EndDate__c, ffrr__Revenue__c
        FROM ffrr__PerformanceObligation__c LIMIT 1
    ];

//Note: The mySourceObject needs to be populated at this point. *How* it is populated,
//naturally, depends on the object type etc. but the extracted record must include the
//ffrrTemplate__c field and any required fields based on that template.
//For example, if the recognition template is of type '% Complete', then the 'Complete' field must be included

//Setup the recognition date that we'll be using
Date recognitionDate = Date.newInstance(2013, 01, 05);

//Call the method
ffrr.CalculationService.Calculation revenueRecord = ffrr.CalculationService.calculateRevenue(mySourceObject, recognitionDate, 'USD');

//Output the results that came back
System.debug('RecognizedToDate: ' + revenueRecord.recognizedToDate);
System.debug('PreviouslyRecognized: ' + revenueRecord.previouslyRecognized);
System.debug('ToRecognizeThisPeriod: ' + revenueRecord.toRecognizeThisPeriod);
System.debug('TotalRevenue: ' + revenueRecord.totalRevenue);
System.debug('CalculatedTotalRevenue: ' + revenueRecord.calculatedTotalRevenue);
System.debug('Errors: ' + revenueRecord.errors);

retrieveRecordDetails

global static ffrr.CalculationService.Record retrieveRecordDetails(Id recordId)

Retrieves the detail of the specified record. The returned data will include the values used in calculations and high level details of the record.

Input Parameters

Name Type Description
recordId Id The record's ID.

Return Value

This service returns a ffrr.CalculationService.Record 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 retrieveRecordDetails method and
//therefore relies on there being data within the system (if no data is available,
//no data will be retrieved). Given the nature of this sample, setting the ID of the
//record to be retrieved isn't possible. If you wish to fully test the sample code
//you will need to configure your Recognition Settings, Recognition Templates etc. and populate recordID
//with the ID of one of your data records
ID recordID = null;

//Call the method
ffrr.CalculationService.Record recordDetails = ffrr.CalculationService.retrieveRecordDetails(recordID);

//Output the data that was returned
system.debug('RecordDetails: ' + recordDetails);

retrieveRecordDetails

global static ffrr.CalculationService.Record retrieveRecordDetails(Id recordId, ffrr.ViewService.ViewType viewType)

Retrieves the detail of the specified record. The returned data will include the values used in calculations and high level details of the record.

Input Parameters

Name Type Description
recordId Id The record's ID.
viewType ffrr.ViewService.ViewType The record's type.

Return Value

This service returns a ffrr.CalculationService.Record 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 retrieveRecordDetails method and
//therefore relies on there being data within the system (if no data is available,
//no data will be retrieved). Given the nature of this sample, setting the ID of the
//record to be retrieved isn't possible. If you wish to fully test the sample code
//you will need to configure your Recognition Settings, Recognition Templates etc. and populate recordID
//with the ID of one of your data records. The View Type determines the type ( e.g. Actual, Forecast) of the records
//to be retrieved.
ID recordID = null;

//Call the method (retrieve details for a record of type Forecast)
ffrr.CalculationService.Record recordDetails = ffrr.CalculationService.retrieveRecordDetails(recordID, ffrr.ViewService.ViewType.FORECAST);

//Output the data that was returned
system.debug('RecordDetails: ' + recordDetails);

ffrr.CalculationService.Calculation

global virtual with sharing class Calculation extends ViewService.Reference

Contains the results of a revenue recognition calculation.

This class extends ffrr.ViewService.Reference

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 Calculation
ffrr.CalculationService.Calculation calc = new ffrr.CalculationService.Calculation();

//Populate the fields inherited from ffrr.ViewService.Reference
calc.id = 'a0va00000059tb8';
calc.name = 'My Calculation';

//Populate the fields from specific to ffrr.CalculationService.Calculation
calc.previouslyRecognized = 112.78;
calc.recognizedToDate = 1222.95;
calc.toRecognizeThisPeriod = 75.25;
calc.totalRevenue = 2000.00;
calc.calculatedTotalRevenue = 1500.00;

//Create a list to hold any errors for the calculation
calc.errors = new List<String>();

//Add the errors to the error list
calc.errors.add('Missing year/period');
calc.errors.add('Total recognized cannot be greater than total revenue');

Properties

Name Type Description
totalRevenue Decimal Total revenue for the calculation.
calculatedTotalRevenue Decimal The modified total revenue used to perform the calculation, based on the Revenue Basis. If no Revenue Basis is specified this matches Total Revenue.
previouslyRecognized Decimal Revenue previously recognized.
recognizedToDate Decimal Total revenue recognized to date.
toRecognizeThisPeriod Decimal Revenue to recognize this period.
errors List<String> List of errors returned by the process.

Methods

Calculation

global Calculation()

ffrr.CalculationService.CalculationPart

global virtual with sharing class CalculationPart

Contains the results of a revenue recognition calculation for Cost or Revenue.

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 Calculation
ffrr.CalculationService.Calculation calc = new ffrr.CalculationService.Calculation();

//Populate the fields inherited from ffrr.ViewService.Reference
calc.id = 'a0va00000059tb8';
calc.name = 'My Calculation';

//Populate the fields from specific to ffrr.CalculationService.Calculation
calc.previouslyRecognized = 112.78;
calc.recognizedToDate = 1222.95;
calc.toRecognizeThisPeriod = 75.25;
calc.totalRevenue = 2000.00;
calc.calculatedTotalRevenue = 1500.00;

//Create a list to hold any errors for the calculation
calc.errors = new List<String>();

//Add the errors to the error list
calc.errors.add('Missing year/period');
calc.errors.add('Total recognized cannot be greater than total revenue');

Properties

Name Type Description
calculatedThisPeriod Decimal Revenue to calculate this period.
calculatedToDate Decimal Total revenue calculated to date.
calculatedTotal Decimal The modified total value used to perform the calculation, based on the Cost/Revenue Basis. If no Cost/Revenue Basis is specified this matches Total Cost/Revenue.
previouslyCalculated Decimal Revenue previously calculated.
total Decimal Total Cost/Revenue for the calculation.

ffrr.CalculationService.CalculationResult

global with sharing class CalculationResult extends ViewService.Reference

This class extends ffrr.ViewService.Reference

Properties

Name Type Description
cost ffrr.CalculationService.CalculationPart
revenue ffrr.CalculationService.CalculationPart
errors List<String> List of errors returned by the process.

Methods

CalculationResult

global CalculationResult()

ffrr.CalculationService.LineDetail

global with sharing class LineDetail extends Calculation

Deprecated:

Contains a complete set of line or summary data as used by the revenue recognition user interface. The structure contains everything needed to recognize the row data.

This class extends ffrr.CalculationService.Calculation

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 account, recognition template and parent/item reference data that we'll need
//Create the reference to the account
ffrr.ViewService.Reference sampleAccount = new ffrr.ViewService.Reference();
sampleAccount.id = 'a1ga00000111sg6';
sampleAccount.name = 'My Account';

//Create the recognition template
ffrr.CalculationService.Template sampleTemplate = new ffrr.CalculationService.Template();
sampleTemplate.id = 'a0ba00000512cc6';
sampleTemplate.name = 'TimeCard Template';
sampleTemplate.calculationType = 'Months / Part Periods';
sampleTemplate.revenueBasis = 'Total Revenue';
sampleTemplate.templateType = 'Equal Split';

//Create the parent/item references
ffrr.ViewService.Reference projectReference = new ffrr.ViewService.Reference();
projectReference.id = 'a0sa00000011op1';
projectReference.name = 'My Project';

ffrr.ViewService.Reference milestoneReference = new ffrr.ViewService.Reference();
milestoneReference.id = 'a0ga00000026abx';
milestoneReference.name = 'My Milestone';

ffrr.ViewService.Reference timecardReference = new ffrr.ViewService.Reference();
timecardReference.id = 'a0va00000059tb8';
timecardReference.name = 'My TimeCard';


//Create the LineDetail
ffrr.CalculationService.LineDetail ldSample = new ffrr.CalculationService.LineDetail();

//Populate the fields inherited from ffrr.ViewService.Reference
ldSample.id = 'a0va00000059tb8';
ldSample.name = 'My TimeCard';

//Populate the fields inherited from ffrr.CalculationService.Calculation
ldSample.errors = new List<String>();

ldSample.recognizedToDate = 1222.95;
ldSample.toRecognizeThisPeriod = 75.25;
ldSample.totalRevenue = 2000.00;

//Populate the fields specific to ffrr.CalculationService.LineDetail
ldSample.account = sampleAccount;
ldSample.stagingRecordID = 'a1za00001024zt2';
ldSample.template = sampleTemplate;

//Specify what type of line this is (detail or summary)
ldSample.lineType = ffrr.CalculationService.LineType.DETAIL;

//Create a list to hold the references to the object and all of its parents
ldSample.parentPath = new List<ffrr.ViewService.Reference>();

//Add the reference to the object and all of its parents
ldSample.parentPath.add(projectReference);
ldSample.parentPath.add(milestoneReference);
ldSample.parentPath.add(timecardReference);

Properties

Name Type Description
account ffrr.ViewService.Reference Account name and ID.
itemHyperlink String The source record ID used to construct the hyperlink in the user interface.
lineType ffrr.CalculationService.LineType The type of record.
linkRecordId Id The record ID used to create the hyperlink in the user interface.
parentPath List<ffrr.ViewService.Reference> List of ids and names of the parent items.
stagingRecordId Id ID of the record in the staging table.
template ffrr.CalculationService.Template The template.
totalChildren Integer The total number of child items (at any level) beneath this line item.
totalDirectChildren Integer The total number of children directly beneath this item.

ffrr.CalculationService.Record

global with sharing class Record extends ViewService.Reference

Contains the required details of a source record, based on the recognition settings and template associated with it.

This class extends ffrr.ViewService.Reference

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 filters that apply to this item
//Create a filter for the billing country
ffrr.ViewService.TabSelectorFilter tsfBillingCountry = new ffrr.ViewService.TabSelectorFilter();
tsfBillingCountry.field = Account.BillingCountry;
tsfBillingCountry.values = new List<String>{'UK', 'US'};

//Create a filter for the industry
ffrr.ViewService.TabSelectorFilter tsfIndustry = new ffrr.ViewService.TabSelectorFilter();
tsfIndustry.field = Account.Industry;
tsfIndustry.values = new List<String>{'Insurance', 'Finance'};


//Create the Record
ffrr.CalculationService.Record rSample = new ffrr.CalculationService.Record();

//Populate the fields inherited from ffrr.ViewService.Reference
rSample.id = 'a0va00000059tb8';
rSample.name = 'My Account';

//Populate the fields specific to ffrr.CalculationService.Record
rSample.delivered = 'True';
rSample.description = 'Time card details for the start of the first quarter';

//Specify the start and end dates of the item
rSample.startDate = date.newInstance(2013, 1, 1);
rSample.endDate = date.newInstance(2013, 3, 31);

//Specify the values that we want to return for this item
rSample.percentageComplete = 25;
rSample.rate = 12.50;
rSample.totalUnits = 500;
rSample.vsoePercent = 80;
rSample.vsoeRate = 12.50;

//Create a list to hold any filters for this item
rSample.filters = new List<ffrr.ViewService.TabSelectorFilter>();

//Add the filters for this item
rSample.filters.add(tsfBillingCountry);
rSample.filters.add(tsfIndustry);

Properties

Name Type Description
startDate Date Value of the mapped field that contains the start date to use in the calculations.
endDate Date Value of the mapped field that contains the end date to use in calculations.
delivered String Value of the mapped field that indicates whether the item is completed or delivered.
description String Value of the mapped field that contains the item's description.
percentageComplete Decimal Value of the mapped field that contains the percentage complete to use in calculations.
filters List<ffrr.ViewService.TabSelectorFilter> List of any filters that have been set up against the item.
rate Decimal Value of the mapped field that contains the rate to use in the calculations.
totalUnits Decimal Value of the mapped field that contains the total number of units to use in calculations.
vsoePercent Decimal Value of the mapped field that contains the VSOE percentage to use in calculations.
vsoeRate Decimal Value of the mapped field that contains the VSOE rate to use in calculations.

ffrr.CalculationService.Template

global with sharing class Template extends ViewService.Reference

Contains the details of the calculation to be applied to the source data.

This class extends ffrr.ViewService.Reference

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 Recognition Template
ffrr.CalculationService.Template tmpSample = new ffrr.CalculationService.Template();

//Populate the fields inherited from ffrr.ViewService.Reference
tmpSample.id = 'a0ba00000512cc6';
tmpSample.name = 'TimeCard Template';

//Populate the fields specific to ffrr.CalculationService.Template
tmpSample.calculationType = 'Days';
tmpSample.revenueBasis = 'Total Revenue';
tmpSample.templateType = 'Equal Split';

Properties

Name Type Description
calculationType String The type of calculation.
revenueBasis String The revenue basis.
templateType String The type of template.

Methods

Template

global Template()

Contains the information of a template.

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 recognition template
ffrr.CalculationService.Template tSample = new ffrr.CalculationService.Template();

//Populate the fields inherited from ffrr.ViewService.Reference
tSample.id = 'a0va00000059tb8';
tSample.name = 'My Template';

//Populate the fields specific for the ffrr.CalculationService.Template
tSample.templateType = 'Equal split';
tSample.revenueBasis = 'Total Revenue';
tSample.calculationType = 'Months';
© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.