onValidateRecord. You simply need to validate that the value passed to onValidateRecord matches your desired format.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Defining your own column type in Fuse.
onValidateRecord. You simply need to validate that the value passed to onValidateRecord matches your desired format.
// matches formats like $10
const currencyRegex = /\$[0-9]*/;
const importer = new FuseImporter();
importer.getSessionToken = ... // see https://fuse-docs.swovo.com/getting-started/sessions
importer.addColumn({
internal_key: "total_charge",
label: "Total Charge",
column_type: "string",
required: true,
position: 1,
unique: true,
});
importer.onValidateRecord = async (record) => {
const errors = {};
const warnings = {};
// make sure the total charge matches the regex
if (!record.total_charge?.match(currencyRegex)) {
errors["total_charge"] =
"Total charge must be a dollar amount matching the format $xx";
}
return {
errors: errors,
warnings: warnings,
};
};
importer.show();