Foundations Apex API Developer Reference

fferpcore.MappingService

global with sharing class MappingService

Retrieve information about custom mappings created by the FDN Mappings component.

Properties

Name Type Description
MAPPING_TYPE_RELATIONSHIP String Indicates that a custom mapping is a relationship mapping that creates child records.
MAPPING_TYPE_STANDARD String Indicates that a custom mapping is a standard mapping between two fields.

Methods

getCustomMappings

global static List<fferpcore.MappingService.CustomMapping> getCustomMappings(String process)

Retrieve the custom mappings for a specific process.
The process must match the name of the Foundations configuration item, including the relevant namespace prefix.
The Process field on the Foundations configuration item record must contain: Foundations Mapping Process.

Input Parameters

Name Type Description
process String The name of the process to retrieve custom mappings for.

Return Value

A list of custom mappings for the specified process.

getCustomMappings

global static Map<String, List<fferpcore.MappingService.CustomMapping>> getCustomMappings(Set<String> processes)

Retrieve the custom mappings for multiple processes.
The processes must match the names of the Foundations configuration items, including the relevant namespace prefixes.
The Process field on each Foundations configuration item record must contain: Foundations Mapping Process.

Input Parameters

Name Type Description
processes Set<String> The names of the processes to retrieve custom mappings for.

Return Value

A map of custom mappings objects for the specified processes, keyed by process name.

fferpcore.MappingService.CustomMapping

global class CustomMapping

Data about a single custom mapping for a single process.

Methods

CustomMapping

global CustomMapping(String process, List<List<String>> sourceKeys, List<List<String>> targetKeys)

Create a custom mapping.
Necessary when overriding the custom mappings in a fferpcore.MappingDescriber .

Input Parameters

Name Type Description
process String The name of the process the custom mapping belongs to.
sourceKeys List<List<String>> The locations of the source data.
targetKeys List<List<String>> The destinations for the mapping data.

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.

String process = 'c2g__SomeProcess';

List<List<String>> sourceKeys = new List<List<String>>{
    new List<String>{'SomeRelationship__r', 'SomeSourceField__c'},
    new List<String>{'SomeOtherRelationship__r', 'SomeOtherSourceField__c'}
};

List<List<String>> targetKeys = new List<List<String>>{
    new List<String>{'SomeTargetField__c'}
};

fferpcore.MappingService.CustomMapping customMapping =
    new fferpcore.MappingService.CustomMapping(process, sourceKeys, targetKeys);

withName

global fferpcore.MappingService.CustomMapping withName(String name)

Specify a name for the custom mapping.
If no name is specified, a name is generated in the form: custom_[SourceKey].

Input Parameters

Name Type Description
name String The name of the custom mapping.

Return Value

The CustomMapping instance to allow further method calls.

withType

global fferpcore.MappingService.CustomMapping withType(String type)

Specify the custom mapping type.
If no type is specified, the default type of Standard is used.

The following values are valid:

  • fferpcore.MappingService.MAPPING_TYPE_STANDARD
  • fferpcore.MappingService.MAPPING_TYPE_RELATIONSHIP

Input Parameters

Name Type Description
type String The type of the custom mapping.

Return Value

The CustomMapping instance to allow further method calls.

withSourcePath

global fferpcore.MappingService.CustomMapping withSourcePath(List<String> path)

Specify the source path of the custom mapping.

Input Parameters

Name Type Description
path List<String> The relationship keys that identify the location of the source data in the record hierarchy.

Return Value

The CustomMapping instance to allow further method calls.

Sample Data

List<String> path: new List<String>{'SomeRelationship__r', 'SomeNestedRelationship__r'}

withTargetPath

global fferpcore.MappingService.CustomMapping withTargetPath(List<String> path)

Specify the target path of the custom mapping.

Input Parameters

Name Type Description
path List<String> The relationship keys that identify the location of the target data in the record hierarchy.

Return Value

The CustomMapping instance to allow further method calls.

Sample Data

List<String> path: new List<String>{'SomeRelationship__r', 'SomeNestedRelationship__r'}

withTransformationTable

global fferpcore.MappingService.CustomMapping withTransformationTable(Id transformationTable)

Specify a data transformation table to apply to the custom mapping.

Input Parameters

Name Type Description
transformationTable Id The record ID of the data transformation table to apply to the mapping.

Return Value

The CustomMapping instance to allow further method calls.

withStaticData

global fferpcore.MappingService.CustomMapping withStaticData(String staticData)

Specify the static data for the custom mapping.

Input Parameters

Name Type Description
staticData String The exact value to map to the target location.

Return Value

The CustomMapping instance to allow further method calls.

withStaticDescription

global fferpcore.MappingService.CustomMapping withStaticDescription(String staticDescription)

Specify a description for the static data in the custom mapping.

Input Parameters

Name Type Description
staticDescription String The description of the static data.

Return Value

The CustomMapping instance to allow further method calls.

withCorrelationStrategy

global fferpcore.MappingService.CustomMapping withCorrelationStrategy(String correlationStrategy)

Specify a correlation strategy for the custom mapping to determine whether child records are created or updated.
The following values are valid:

  • Append
  • Replace
  • Update
  • UpdateTotal

Input Parameters

Name Type Description
correlationStrategy String The identifier for the correlation strategy.

Return Value

The CustomMapping instance to allow further method calls.

withCorrelationSourceKey

global fferpcore.MappingService.CustomMapping withCorrelationSourceKey(List<String> correlationSourceKey)

Specify the field on the source that contains a unique identifier.
This is used to synchronize source and target data.

Input Parameters

Name Type Description
correlationSourceKey List<String> The field on the source that contains a unique identifier.

Return Value

The CustomMapping instance to allow further method calls.

withCorrelationTargetKey

global fferpcore.MappingService.CustomMapping withCorrelationTargetKey(String correlationTargetKey)

Specify a field on the target in which to store the source's unique identifier.
The unique identifier is compared when updating the target.

Input Parameters

Name Type Description
correlationTargetKey String The field on the target in which to store the source record's unique identifier

Return Value

The CustomMapping instance to allow further method calls.

withFilters

global fferpcore.MappingService.CustomMapping withFilters(List<String> filters)

Specify a filter that determines whether to create or update target records.

Input Parameters

Name Type Description
filters List<String> The source field that determines whether records are created or updated. For records to be created or updated, the value must evaluate to true.

Return Value

The CustomMapping instance to allow further method calls.

withLookupField

global fferpcore.MappingService.CustomMapping withLookupField(String lookupField)

Input Parameters

Name Type Description
lookupField String The API name of the additional field on the source. This is used for lookup mappings to identify a lookup record.

Return Value

The CustomMapping instance to allow further method calls.

withAdditionalLookupField

global fferpcore.MappingService.CustomMapping withAdditionalLookupField(String additionalLookupField)

Input Parameters

Name Type Description
additionalLookupField String The API name of an additional field on the source. This is used for lookup mappings to identify a single lookup record when record names are not unique.

Return Value

The CustomMapping instance to allow further method calls.

withTargetChildType

global fferpcore.MappingService.CustomMapping withTargetChildType(String targetChildType)

Specify the name of the category for the target child record.
Target child types enable you to create multiple target child records from a single source child record.
For example, Default, Debit Line, or Admin Fee.
If blank, Default is assigned as the target child type.

Input Parameters

Name Type Description
targetChildType String The target child type for the mapping.

Return Value

The CustomMapping instance to allow further method calls.

withCondition

global fferpcore.MappingService.CustomMapping withCondition(List<String> condition)

Specify the condition key to use for this mapping.

Input Parameters

Name Type Description
condition List<String> The condition key for this mapping. When specified, the source data value must evaluate to true for the mapping to be applied.

Return Value

The CustomMapping instance to allow further method calls.

getProcess

global String getProcess()

Return Value

The process this custom mapping belongs to.

getName

global String getName()

Return Value

The name of the custom mapping. Null if no name was provided.

getType

global String getType()

Identify the type of the custom mapping.

The following values can be returned:

  • fferpcore.MappingService.MAPPING_TYPE_STANDARD
  • fferpcore.MappingService.MAPPING_TYPE_RELATIONSHIP

Return Value

The type of the custom mapping.

getSourceKeys

global List<List<String>> getSourceKeys()

Return Value

All the source key paths.

Sample Data

SomeField__c
SomeLookup__r, SomeOtherField__c

getSourceKey

global List<String> getSourceKey()

Return Value

The first source key path.

Sample Data

SomeLookup__r, SomeOtherField__c

getSingleSourceKey

global String getSingleSourceKey()

Return Value

The first source key in the first source key path.

Sample Data

SomeField__c

getTargetKeys

global List<List<String>> getTargetKeys()

Retrieve the target keys for the custom mapping.
This is not currently required. The FDN Mappings component currently only supports mappings with a single target key.

Return Value

All the target key paths.

getSingleTargetKey

global String getSingleTargetKey()

The first target key in the first target key path.

Sample Data

SomeTargetField__c

getSourcePath

global List<String> getSourcePath()

Return Value

The relationship keys that identify the location of the source data in the record hierarchy.

Sample Data

SomeRelationship__r, SomeNestedRelationship__r

getTargetPath

global List<String> getTargetPath()

Return Value

The relationship keys that identify the location of the target data in the record hierarchy.

Sample Data

SomeRelationship__r, SomeNestedRelationship__r

getTransformationTable

global Id getTransformationTable()

Return Value

The record ID of the data transformation table associated with the mapping.

getStaticData

global String getStaticData()

Return Value

The exact value to map to the target location.

getStaticDescription

global String getStaticDescription()

Return Value

The description of the static data.

getCorrelationStrategy

global String getCorrelationStrategy()

Identify the correlation strategy of the custom mapping.
The following values can be returned:

  • Append
  • Replace
  • Update
  • UpdateTotal

Return Value

The correlation strategy, which specifies how to create and maintain linked data.

getCorrelationSourceKey

global List<String> getCorrelationSourceKey()

Return Value

The field on the source that contains a unique identifier. This is used to synchronize source and target data.

getCorrelationTargetKey

global String getCorrelationTargetKey()

Return Value

The target field that contains the source's unique identifier. The unique identifier is compared when updating the target.

getFilters

global List<String> getFilters()

Return Value

The source field that determines whether records are created or updated. For records to be created or updated, the value must evaluate to true.

getLookupField

global String getLookupField()

Return Value

The API name of the primary field on the source. This is used for lookup mappings to identify a lookup record.

getAdditionalLookupField

global String getAdditionalLookupField()

Return Value

The API name of an additional field on the source. This is used for lookup mappings to identify a single lookup record when record names are not unique.

getTargetChildType

global String getTargetChildType()

Return Value

The name of the category for the child record. Target child types enable you to create multiple target child records from a single source child record.

Sample Data

Default, Debit Line, Admin Fee

getCondition

global List<String> getCondition()

Return Value

The condition key for this mapping. Conditions enable you to update a target field based on specific information on the source. When specified, the source data value must evaluate to true for the mapping to be applied.

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