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 Definition for each of the given Recognition Settings using the fields defined in those recognition settings. The Default Field Mapping will be populated on each of the recognition 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 recognition 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 Definition for each of the given Recognition Settings using the fields defined in those recognition settings. The Default Field Mapping will be populated on each of the recognition settings. If a given recognition setting already has a Default Field Mapping it can be specified to update it.

Input Parameters

Name Type Description
settingIds List<Id> List of recognition 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 recognition 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 recognition 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 Recognition Settings Id and the options.
// Based on the fields in the recognition 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 with sharing 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 recognition 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 with sharing class UpsertResult

Container for data resulting from an Upsert operation.

Properties

Name Type Description
FieldMappingDefinitionIds List<Id> Ids of FieldMappingDefinitions created or Updated in this operation.
SettingIds List<Id> Ids of recognition settings that have had FieldMappingDefinitions created.

Methods

UpsertResult

global UpsertResult()

© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.