Custom Code
Using your own javascript custom code to enrich or reformat data inputs.
Last updated
Using your own javascript custom code to enrich or reformat data inputs.
Last updated
By adding a 'Custom Code' step into the step builder, you can input your own custom code to enrich or reformat inputs in any way to choose to.
How might you use the 'Custom Code' step?
To transform data, or for complex rules or calculations. It provides flexibility to achieve results that the existing steps aren't capable of.
The step will always have access to the output of all previous steps that can be invoked by using the {{input}}
syntax. You can use any native javascript to return an object that can be mapped to outputs.
Lodash (_) and MathJS libraries are also included within the code context to use as you like.
An Object must always be returned so that the format step has something to map against. The step will throw an error if an object isn't returned.
Try the code by clicking on the try button:
You format the output the same way as you would in the transform step. You will have access to the output object from the customCode.
The step will auto-generate the output formats that it thinks you want. You can amend this outputs using the edit button after hovering over the new output.