Each column type in Fuse has built-in data validations. There is a lot you can do out of the box.

Because each column type has different built-in data transformations, you should refer to the documentation of a specific column type to see the available options.

When the built-in data validations are insufficient, you can create custom front-end data validations using the onValidateRecord hook on your importer.

onValidateRecord(record)

The onValidationRecord hook is called for each row (record) in the importer. It allows you to display front-end validations in the importer for the user to fix.

The record object passed to onValidateRecord contains all of the values for a single row in the importer. You can access values in the record object using the internal_key of each column in your importer.

The onValidateRecord hook returns an errors object with two properties: errors and warnings.

Errors block the user from submitting the importer. These are items that must be fixed.

Warnings provide a warning message to the user about potential issues. However, a user can submit the importer with warnings present.

Example

importer.onValidateRecord = async (record) => {
  const errors = {};
  const warnings = {};

  // force emails to include gmail
  if (!record.email?.includes("gmail")) {
    errors["email"] = "Email must from gmail";
  }

  return {
    errors: errors,
    warnings: warnings,
  };
};