Celigo Presave hook with Example
Category : Uncategorized
Hooks means its a custom code that can be used in different stages during the execution of flow (exports,imports), to modify the processing data.
Export stage consists of 2 hook types:
1. Presave
2. Presend
PRESAVE
The presave hook works after the export completes and before the data is taken from the destination application.
This hook is mainly used to format,filter,perform logics etc on the data coming from export before the data moves on to the Import or lookup stages.
Main requirements
I. Data formatting
II. Perform operations
III. Filter out the data
Create a preSave hook
- Login to celigo integrator.io.
- Create flow or open a flow and complete the export stage.
- Click the + icon on the export stage.
- when we click the hook icon , a window pops up.
Window contains Hook type, Presave page function and Scripts
Hook Type :
- Script :Code is managed and executed by integrator.io
- Stack :Code will be hosted on either your server or AWS
When we click on the drop down under scripts,it will show all available options.Then we can select the appropriate script and edit it using the pencil icon on the right side of the drop down.
OR we can create a new script then click the +icon on right side of scripts,then a new window pops up.
- Type the name in Name field and also select pre save page in Insert function stub, then click save&close button.
- To edit the selected script,click the edit button on right side of scripts.
This is the FUNCTION INPUT that comes from export.
This is the SCRIPT EDITOR for editing the script,or create script.
After completing the script, when we click the preview button,
- Preview Button : When we click the button it will display the preview of the script.
- Function Output: Display the preview output.
- Console : This is the message box that displays messages for the script.
Example : To change date format
When we change the format of payment_date,
After Creating the script , Click the preview button we can see the preview in function
Output.
In function output we will see new variable paymentdate_new that store new formatted date.
Click the save & close button.