Example: You can have can put all your code in one script, or you can split your code across multiple scripts so that you delegate different projects to various users.
- The homepage and menu for integrator.io was changed in March, 2019. The grid menu was removed in that change, and scripts were moved to Tools & Resources in the navigation bar. Find out more about where things are on the new homepage.
- Scripts can be referenced by any number of resources in your integrator.io account and changing a script should always be done with caution.
Create & edit your script
- Navigate to integrator.io.
- At the top, click Tools & Resources.
- Click Scripts.
- At the top right, click + New Script.
- Enter a name and a description for your script. Tip: Give your script a name that will make it easily recognizable to others working on your integration.
- Click Save. You'll automatically return to the list of scripts.
- In the table on the left, find the name of your script.
- To the right of your script's name, under "Actions," click the down arrow.
- Click Edit script. The editor will open.
- Edit your script.
- Click Save.
Use Script in Export
To use a script in the Export page:
1. On the Edit Export page, under Hooks, select Hook Type as Script.
2. From the Please Select a Script drop-down list box, select the script that you want to use.
3. In Pre Save Page, provide the exact pre save page function name as present in the script you have selected.
Info: You can also leave this text box blank if there is only one function in the script. The function name will be automatically picked up from the selected script. However, if the selected script contains two or more functions, you must provide the function name to be executed. Otherwise, by default, the first function name present in the script will be fetched in this text box.
4. Click the Pencil icon beside the selected script to preview the data input and output and to perform any modifications to the code if required.
5. Click Save. This script will be executed before the import.
Use Script in Import
The procedure for using the Script in Import is similar to that of Use Script in Export. It is just that you select the appropriate function on the Import page while creating a flow. On the Import page, you will see functions, such as Pre Map, Post Map, Post Submit, and Post Aggregate based on the selected application.
Insert Function Stub
In the image below, we are illustrating how to insert the PreSavePage stub. On the Export page, when you click the Insert PreSavePage Stub button, it populates the default code for the preSavePageFunction that can be used to write custom code. Similarly, on the Import page, you can use this button to insert stubs for Pre Map, Post Map, Post Submit, and Post Aggregate functions.