Foundations Apex API Developer Reference

fferpcore.SObjectConsumer

global inherited sharing class SObjectConsumer

Helper class to be used within a fferpcore.VirtualDataObject.Consumer to create or update SObjects. Uses the fferpcore.VirtualDataObjectTargetMapping metadata records to determine what data from the records to write to the target SObjects.

Methods

SObjectConsumer

global SObjectConsumer(SObjectType targetObject, SObjectField correlationField, String consumer)

Construct an SObjectConsumer.

Input Parameters

Name Type Description
targetObject SObjectType The type of SObjects to be created or updated.
correlationField SObjectField The field on the SObject used to identify it when updating.
consumer String The name of the consumer, matching what is specified on each target mapping.

withCorrelationKey

global fferpcore.SObjectConsumer withCorrelationKey(String correlationKey)

Specify the key on the records to use when comparing them to existing SObjects. If this is not specified, the correlation ID is derived from the getId method of each Record.

Input Parameters

Name Type Description
correlationKey String The key on the record to be used for correlation.

Return Value

The same SObjectConsumer instance to allow further method calls.

withRequirePermissions

global fferpcore.SObjectConsumer withRequirePermissions(Boolean requirePermissions)

Specify whether the user must have suitable permissions to read the source records, and write the target records. By default, these permissions are not required.

Input Parameters

Name Type Description
requirePermissions Boolean True if permissions are required.

Return Value

The same SObjectConsumer instance to allow further method calls.

withDryRun

global fferpcore.SObjectConsumer withDryRun(Boolean dryRun)

Prevent the created SObjects being committed to the database. Existing SObjects may be read from the database. Results are available using the getSObjects method. No trigger validation will be run because no database writes are performed Therefore trigger and database level errors will not be detected.

Input Parameters

Name Type Description
dryRun Boolean True to prevent committing to the database.

Return Value

The same SObjectConsumer instance to allow further method calls.

prepare

global void prepare(fferpcore.VirtualDataObject.Provider provider)

Prepare the given Provider so any data required by the target mappings is available.

Input Parameters

Name Type Description
provider fferpcore.VirtualDataObject.Provider The provider to be prepared.

consume

global void consume(fferpcore.VirtualDataObject.RecordList recordList)

Process the given RecordList to create or update the target SObjects.

Input Parameters

Name Type Description
recordList fferpcore.VirtualDataObject.RecordList The RecordList to be processed.

getOutputRecordsByInputId

global Map<String, fferpcore.VirtualDataObject.SObjectRecord> getOutputRecordsByInputId()

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