Transformer
Custom Javascript code in action flow
Last updated
Custom Javascript code in action flow
Last updated
In a action of the action flow, transformer enable you to write custom Javascript function for data calculation and transformation within action flows, which provide you with limitless potentials.
Transformers serve as an alternative to input fields, and these two modes cannot be active simultaneously.
To switch to transformer mode, click the ƒ(x)
. This action will open the transformer code editor, allowing you to write your custom JavaScript code.
After entering the code editor, you'll find a transformer function. Please refrain from modifying the input and output definitions; instead, write your logic within the function.
The payload
is an object that contains event payload data, determined by the element and event triggering it.
The context
is used to retrieve data from query results or data store variables, much like the Accessors. To access query result data, use context.getData("#query_name")
. For app data, use context.getData("#app.variable_name")
, and for page data, use context.getData("#page.variable_name")
.
The returned parameters object will be the parameters for the action. The fields are determined by the action type. Here is an example of using transformer to . map_input
is a variable in App Data, and in the transformer, an object is constructed and assigned the value of the map_input
variable.