Revenue Management API Developer Reference

ffrr.SettingsService

global with sharing class SettingsService

The ffrr.SettingsService provides classes and methods for operations related to the ffrr__Settings__c records.

Methods

createMappingsToPOLI

global static ffrr.SettingsService.UpsertResult createMappingsToPOLI(List<Id> settingIds)

Creates a Field Mapping Defintion for each of the given Settings using the fields defined in those Settings. The Default Field Mapping will be populated on each of the Settings.

Input Parameters

Name Type Description
settingIds List<Id> List of setting records that the Field Mapping Definition and Field Mapping records will be created for.

Return Value

A SettingsService.UpsertResult containing the Ids of the created Field Mapping Definitions and the Ids of the settings used to create them.

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 Settings Service is used to create Field Mapping Definitions
// from the provided Setting to the Performance Obligation Line Item SObject.

// Retrieve the Setting that will be used to create the Field Mapping Definition
Id settingId = [SELECT Id FROM ffrr__Settings__c WHERE ffrr__Object__c = 'Account' AND ffrr__UseInRevenueContract__c = true LIMIT 1].Id;

// Call the Service providing the Settings Id.
// Based on the fields in the settings record the relevant Field Mappings will 
// be created under this Field Mapping Definition.
ffrr.SettingsService.UpsertResult result = ffrr.SettingsService.createMappingsToPOLI(new List<Id>{settingId});

createMappingsToPOLI

global static ffrr.SettingsService.UpsertResult createMappingsToPOLI(List<Id> settingIds, ffrr.SettingsService.UpsertOptions options)

Creates a Field Mapping Defintion for each of the given Settings using the fields defined in those Settings. The Default Field Mapping will be populated on each of the Settings. If a given Setting already has a Default Field Mapping it can be specified to update it.

Input Parameters

Name Type Description
settingIds List<Id> List of setting which require FieldMappingDefinitions to be created or updated.
options ffrr.SettingsService.UpsertOptions Instance of Options class. Used to specify whether a new Field Mapping Definition for the provided Settings will be created or the existing updated. If the Field Mapping Definition is replaced the existing one does not get deleted.

Return Value

A SettingsService.UpsertResult containing the Ids of the created Field Mapping Definitions and the Ids of the settings used to create them.

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 Settings Service is used to create Field Mapping Definitions
// from the provided Setting to the Performance Obligation Line Item SObject.

// Retrieve the Setting that will be used to create the Field Mapping Definition
Id settingId = [SELECT Id FROM ffrr__Settings__c WHERE ffrr__Object__c = 'Account' AND ffrr__UseInRevenueContract__c  = true AND ffrr__DefaultFieldMappingDefinition__c != null LIMIT 1].Id;

// Specify to update the default Field Mapping Definition record related to this Setting.
ffrr.SettingsService.UpsertOptions options = new ffrr.SettingsService.UpsertOptions();
options.UpdateMappings = true;

// Call the Service providing the Settings Id and the options.
// Based on the fields in the settings record the relevant Field Mappings under 
// this Field Mapping Definition will be updated (or created if they don't exist).
ffrr.SettingsService.UpsertResult result = ffrr.SettingsService.createMappingsToPOLI(new List<Id>{settingId}, options);

ffrr.SettingsService.UpsertOptions

global class UpsertOptions

Contains additional options regarding the upserting of FieldMappingDefinitions.

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.

// The UpsertOptions class is used to provide additional information
// when creating Field Mapping Definitions.

// Create the Options
ffrr.SettingsService.UpsertOptions options = new ffrr.SettingsService.UpsertOptions();

// Set the updateMappings boolean field which controls whether existing 
// Field Mapping Definitions are updated(true) or replaced(false). 
// The default is false.
options.updateMappings = true;

Properties

Name Type Description
UpdateMappings Boolean Specifies whether a new Field Mapping Definition for the provided Settings will be created or the existing updated. If the Field Mapping Definition is replaced the existing one does not get deleted.

Methods

UpsertOptions

global UpsertOptions()

Default constructor. Defaults the UpdateMappings Boolean to FALSE.

ffrr.SettingsService.UpsertResult

global class UpsertResult

Container for data resulting from an Upsert operation.

Properties

Name Type Description
SettingIds List<Id> Ids of settings that have had FieldMappingDefinitions created.
FieldMappingDefinitionIds List<Id> Ids of FieldMappingDefinitions created or Updated in this operation.
© Copyright 2009–2018 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.