Dromo’s Hooks help you reformat, validate, and correct data automatically via custom functions per column and/or row. For example, using these hooks you can automatically reformat area codes or country codes, remove special characters, validate emails against external data, or anything else you can think of.
values
, with an array of objects. Each object corresponds to one value in the column, and has two parameters.
Sample input and output
Name | |
---|---|
Michelle Doe | michelledoe@gmail.com |
Jane Doe | janedoe@gmail.com |
Steve Jones | steve@hotmail.com |
Wayne Gretzky | wayne@nhl.com |
Email
field would be passed the following data:Column hook example
"init"
mode after the column matching step and before the user begins the review step, and are run with the full dataset.
Row hooks are run again in "update"
mode after each time the user changes any data, with only the changed rows.
init
, and once for every row that changed on update
.
Standard row hooks are called with two arguments.
row
object will have keys matching the field key of each mapped field. Each of these keys will contain an object with data and metadata of that field in the given row.
"init"
if running before the start of the review step, and "update"
if running due to a user change.
row
object should contain keys matching the field key of each mapped field. If a mapped field is omitted, it will remain unchanged.
Each field key object may have the following entries:
info
is omitted, messages will remain unchanged.
update
mode.Standard row hook example
init
with the full dataset, and a single time on update
with all of the changed rows.
Bulk row hooks are a good fit if you need to perform potentially long-running operations that can be optimized by processing all changes in a single function call.
Bulk row hooks work exactly like standard row hooks, except the first parameter is an array of record objects instead of a single record object. Similarly, bulk row hooks must return an array of record objects, preserving the index
parameter of each record.
Bulk row hook example
row
object will have keys matching the field key of each mapped field. Each of these keys will contain an object with data and metadata of that field in the given row.
Row delete hook example
addField
.
UPLOAD_STEP
hookUpload step hook example
REVIEW_STEP
hooknull
.
null
if no file was uploaded.
null
if no file was uploaded.
manyToOne
.
manyToOne
.
manyToOne
field.
Review step hook example
REVIEW_STEP_POST_HOOKS
hooknull
if no file was uploaded.
null
if no file was uploaded.
Review step post hooks example
REVIEW_STEP_PRE_SUBMIT
hookbeforeFinish
runs. It can be useful for customizing the ‘Are you ready to submit?’ dialog with info summarizing the changes and impact of the import data.
The function is called with two arguments.
null
if no file was uploaded.
null
if no file was uploaded.
Review step pre submit example
"error"
message is highlighted in red. It is considered a validation error and impacts the user’s submission options based on invalidDataBehavior
"warning"
message is highlighted in yellow"info"
message is highlighted in blueinstance.addField
{ before: fieldKey }
or { after: fieldKey }
where fieldKey
is the key
of a mapped field. If no mapped field with the given key exists, the new field will be added to the end.
instance.removeField
addField
to concatenate columns and remove the originals, i.e. combine firstName
+ lastName
into fullName
and remove firstName
and lastName
from the result data.
instance.updateInfoMessages
manyToOne
is enabled on a field, you can use this property to select which mapped column shall receive the updates.
updateInfoMessages example
instance.addRows
row
object should contain keys matching the field key of each mapped field. If a mapped field is omitted, it will remain unchanged.
Each field key object may have the following entries:
instance.removeRows
instance.setConfirmationMessage