RecordInFlight represents a single record as it moves through the Valence framework. RecordInFlight holds not just the record properties but also metadata such as errors and warnings associated with the record.

Record Data

We think of each data record as a simple map of key-value pairs. We represent this in Apex using a Map<String, Object>. RecordInFlight internally uses two of these maps, one with the original properties that it was first created with, one with the properties as they are manipulated and changed by Filters.

RecordInFlight Data Methods

// constructor
global RecordInFlight(Map<String, Object> originalProperties);

global Map<String, Object> getProperties();

global Map<String, Object> getOriginalProperties();

Working with Record Data

Map<String,Object> props = new Map<String,Object>{
    'firstName' => 'Tom',
    'lastName' => 'Sinatra'

// creating a RecordInFlight
valence.RecordInFlight tom = new valence.RecordInFlight(props);

// accessing the original properties
System.assertEquals('Sinatra', tom.getOriginalProperties().get('lastName'));

// accessing properties that have possibly been changed

Reporting Errors and Warnings

Any Adapter or Filter that touches a RecordInFlight can mark that record as having an issue of some kind. Adding errors and warnings to a record has different outcomes depending on how the Valence user has configured the Link.

global Boolean hasWarnings();

global void addWarning(String warning);

global void addWarning(String warning, Exception e);

global Boolean hasErrors();

global void addError(String error);

global void addError(String error, Exception e);

Ignoring Records

If you would like to skip the processing of certain records you can call the ignore method. This removes the record from further processing, and will also track ignore reasons and counts and surface those in the interface for an admin to see.

global Boolean isIgnored();

global void ignore(String reason);


Every RecordInFlight has an operation, which is just a string value that suggests an action to the TargetAdapter. The default operation value is “upsert”. We recommend every SourceAdapter and TargetAdapter support at a minimum these two operations:

  • upsert
  • delete

You are welcome to create custom operation values as long as the TargetAdapter you are working with knows how to handle them.

global void setOperation(String operation);

global String getOperation();

Salesforce Id

Our first-party Adapters that work with Salesforce orgs will always populate a Salesforce Id value that you can use if you need it.

global Id getSalesforceId();