Skip to main content
Version: v3

Working with records

After finishing this guide, you will be able to discern how and when to manipulate records in Data Hooks and when to use the SDK.


caution

This section is being deprecated. Please refer to Data Hooks in code

What are records?

Records are the core object that Flatfile's data exchange is built around. You can manipulate them in Data Hooks or use them to easily transfer, modify, or validate data via our powerful SDK.

Properties

recordId

A case sensitive, universally unique reference to this record you can use when working with this record via the SDK, API or Data Hooks.

record.recordId; // re_h7LkU3_Au77X2

Methods

get(field)

Get a specific value from a record. The field must exist on the schema the record is stored in or an error will be thrown.

const name = record.get("full_name");
const { firstName, lastName } = splitName(name);

set(field, value)

record.set("first_name", first_name).set("last_name", lastName);

Adding feedback

info

All messages are visible on hover of a given cell and are available via API. Many messages may be combined. But styling will be applied in following priority:

Error -> Warning -> Info

This means that a cell with both an Error and an info message will be styled as Error.

addInfo(field, message)

Adds an info level feedback message to a specific value in a row. This will results in the following changes to the cell:

  1. A dotted underline will appear under any visible text
  2. There will no behavior change to the record

addComment(field, message)

Adds an info level feedback message to a specific value in a row (an alias to addInfo). This will results in the following changes to the cell:

  1. A dotted underline will appear under any visible text
  2. There will no behavior change to the record

addError(field, message)

danger

Records with errors attached after the last modification can not be submitted.

Adds an error level feedback message to a specific cell. This will results in the following changes to the cell:

  1. A dark red border around the cell
  2. A light red background to the cell
  3. The record will be marked as invalid and can not be submitted until the user corrects the data

addWarning()

info

Use this when you would like to display an error but you would like the user to be able to user their judgement to ignore it and continue.

Adds a warn level feedback message to a specific cell. This will results in the following changes to the cell:

  1. An orange border around the cell
  2. A light yellow background to the cell
  3. The record will be marked as invalid, however the user can ignore the warning the record will return to a valid state allowing it to be submitted.