A hook is custom code that runs at a fixed point in a flow step — after an export retrieves a page of records, before an import maps them, after the destination responds — to change the records or the step's behavior in ways the built-in settings can't. Each step kind offers a different set of hooks, and each hook accepts some script formats and not others. This article is the reference for that: which hooks exist on exports, lookups, listeners, and imports, where you set each one, and which formats it runs. For how to write the scripts, see JavaScript hooks.
Hooks by step kind
| Step kind | Hook | Runs | Actions menu item | JavaScript | Stack | SuiteScript 1.0 | SuiteScript 2.0 |
|---|---|---|---|---|---|---|---|
| Export or lookup that reads files | preParse | On the raw file data before it's parsed into records, and on a non-binary file before it's passed downstream | — (see the file connector's export article) | Yes | — | — | — |
| NetSuite export or lookup | preSend | In NetSuite, before the records are sent to integrator.io | — (see SuiteScript hooks overview) | — | — | Yes | Yes |
| Export, lookup, or listener | preSavePage | On each page of records after retrieval, before the page is saved for the next step | Actions > Pre save page hook | Yes | Yes | — | — |
| Import or tool step | preMap | On the records before mapping | Actions > Pre map hook | Yes | Yes | Yes | — |
| Import or tool step | postMap | On the mapped records before they're sent | Actions > Post map hook | Yes | Yes | Yes | Yes |
| Import | postSubmit | After the destination responds, before the response is mapped | Actions > Post submit hook | Yes | Yes | Yes | Yes |
| Import that writes files | postAggregate | After all records have been written to the output file | — (see the file connector's import article) | Yes | Yes | — | — |
| Import or tool step | postResponseMap | After the response is mapped onto the record | Actions > Post response map hook | Yes | Yes | — | — |
Hooks with an Actions menu item are set from the step's Actions menu on the canvas; see Configure flow step options. The other three are set in the step's own settings, which depend on the connector.
Rules that apply to every hook
- Hooks work on the JSON records in the flow, including records parsed from a file or uploaded with Data loader. A hook can't change a file that passes through the flow as a BLOB; the exception is preParse, which sees the raw file data before parsing.
- In a NetSuite step, use the SuiteScript version that matches the NetSuite API version the step uses.
- A hook is a reference to a script or a stack, so one script can serve several steps. The script editor shows a Used by count; select it to see every export, import, and integration that references the script before you change it.
Script or stack
- A script is JavaScript that integrator.io stores and runs for you. Scripts live at Resources
> Scripts and are shared across steps and flows; see Create hook scripts for exports and imports.
- A stack is code you host — on your own server or as an AWS Lambda function — that integrator.io calls at the hook point. Use a stack when the logic needs more time or resources than a script allows; see Stack hooks.
- SuiteScript hooks run inside NetSuite rather than in integrator.io; see SuiteScript hooks overview.