Articles in this section

Create hook scripts for exports and imports

You can write your own JavaScript to implement hooks, filters, and data transformation. You can organize scripts to fit your needs, such as placing a single hook or multiple functions within a shared script. Always be aware that a script can be referenced by multiple integration resources, which means that a change to one import’s hook could affect another import’s code, depending on how you organize your account.

Tip

Using resource aliases makes scripts easier to maintain.

Create a script

Note

When you save a script, it is stored in an environment-specific location (Sandbox vs. Production). If you create a script in the Sandbox environment, you will not have access to that script in the Production environment (and vice versa). You can duplicate scripts between environments by cloning an integration that references the script.

  1. Sign in to integrator.io and expand the Resources section of the left navigation menu.

  2. Click Scripts.

  3. At the top right, click + Create script.

  4. Enter a name and a description for your script. Give your script a name that will make it easily recognizable to others working on your integration.

  5. Click Save & close.

  6. Click the script’s Actions overflow (...) menu and select Edit script.

    filterFunction.png
  7. You can modify the script in the Edit content section or expand it for the full Advanced field editor.

  8. Click Save.

Create an export hook script

Use the following steps to create a preSavePage export hook script:

  1. Open a flow, click + on the source application, and click the hook icon.

  2. For Hook type, choose Script or Stack depending on where you want to store the script.

  3. In the Pre save page section, enter the pre save page function name as defined in the script. You can select an existing script from the Scripts drop-down menu or click the pencil icon to write a new script.

    Note

    You can leave the function name blank if there is only one function in the selected script. However, if the selected script contains two or more functions, you must provide the function name to be executed; otherwise, the first function present in the script automatically populates as the function name.

  4. Click the pencil icon beside the selected script to open the Script editor where you can preview the data input and output and perform any modifications to the code if required.

    scriptEditor.png
  5. Click Save & close. This script will be executed after the export and before the import.

Create an import hook script

Use the following steps to create a pre map, post map, or post submit import hook script:

  1. Open a flow, click + on the import step, and click the hook icon.

  2. For Hook type, choose Script or Stack depending on where you want to store the script.

  3. In the Pre map, Post map, or Post submit section, enter the function name as defined in the script. You can select another script from the Scripts list or click the Edit (pencil.svg) button to code a new one.

    Note

    You can leave the function name blank if there is only one function in the selected script. However, if the selected script contains two or more functions, you must provide the function name to be executed; otherwise, the first function present in the script automatically populates as the function name.

  4. Click the pencil icon beside the selected script to open the Script editor where you can preview the data input and output and perform any modifications to the code if required.

Was this article helpful?
1 out of 3 found this helpful

Comments

1 comment
Date Votes
  • When you click on the context menu to edit the script, it's not "Edit Script", but "Edit Script Content"

    0

Please sign in to leave a comment.