Celigo Presave hook with Example

Celigo Presave hook with Example

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


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 : 

  1. Script :Code is managed and executed by integrator.io
  2. 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,

  1. Preview Button  : When we click  the button it will display the preview of the               script.
  2. Function Output: Display the preview output.
  3. 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


 In function output we will see  new variable paymentdate_new that store new formatted  date.

Click the save & close button.