Revenue Management API Developer Reference


global with sharing class CalendarService



global static Map<Id, List<Id>> createYears(List<ffrr.CalendarService.RecognitionYear> years)

Commit a list of Recognition Years with periods generated according to each year's period calculation basis.

Input Parameters

Name Type Description
years List<ffrr.CalendarService.RecognitionYear> The years to commit and generate periods for.

Return Value

A map of the committed year Ids to their respective period 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 years will be created and passed to the API where the periods will be generated and
// both the year and periods are committed to the database.

ffrr.CalendarService.RecognitionYear year2014 = new ffrr.CalendarService.RecognitionYear();
year2014.Name = '2014';
year2014.StartDate = Date.newInstance(2014, 1, 1);
year2014.NumberOfMonths = 12;
year2014.PeriodCalculationBasis = 'Month';

ffrr.CalendarService.RecognitionYear year2015 = new ffrr.CalendarService.RecognitionYear();
year2015.Name = '2015';
year2015.StartDate = Date.newInstance(2015, 1, 1);
year2015.NumberOfWeeks = 52;
year2015.PeriodCalculationBasis = '4,4,5';

// The returned result is a Map of the yearIds and the period Ids created for those years.
Map<Id, List<Id>> periodIdsByYearIdMap = ffrr.CalendarService.createYears(new List<ffrr.CalendarService.RecognitionYear>{ year2014, year2015 });


global class RecognitionYear

This represents a Recognition Year record.


Name Type Description
Id Id The Id of the Recognition Year.
Name String The name of the Recognition Year.
NumberOfMonths Decimal The number of months in the Recognition Year, in the range 1-18. Required if the period calculation basis is Month or Month End. Either number of months should be set or number of weeks.
NumberOfWeeks Decimal The number of weeks in the Recognition Year, in the range 13-79. This must be a number divisible by 13 (13, 26, 39, 52, 65, 78) or divisible by 13 plus one week (14, 27, 40, 53, 66, 79). Required if the period calculation basis is 445, 454, or 544. Either number of months should be set or number of weeks.
PeriodCalculationBasis String The period calculation basis for the Recognition Year. Permitted values are: '4,4,5', '4,5,4', '5,4,4', 'Month', 'Month End'.
StartDate Date The start date of the Recognition Year.



global RecognitionYear()

© Copyright 2009–2018, inc. All rights reserved. Various trademarks held by their respective owners.