Execute Function
Call a previously defined function and execute its logic within your flow.
Execute Function
The Execute Function block allows you to run a logic flow that has been defined as a reusable Function. This is essential for keeping your project organized and avoiding the repetition of the same logic across multiple endpoints.
Core Concept
Think of a Function like a specialized machine in a factory. Instead of building that machine every time you need it on a production line, you build it once and "call" it whenever it's needed. You can give it specific materials (Parameters), and it can give you back a finished product (Response).
Configuration
| Field | Required | Description |
|---|---|---|
| Function | ✅ | Select the function you wish to execute from your project's list of functions. |
| Wait for Function Call | — | If enabled, the block will wait for the function to complete its execution before moving to the next block in the main flow. This is required if you want to use the function's output. |
| Parameters | — | Provide values for the inputs defined in the function's configuration. These values are passed into the function's scope. |
| Response Variable | — | The name of the variable where the function's result will be stored. This field is only visible when Wait for Function Call is active. |
Inside the function, you can access the passed parameters using standard variable syntax, for example: {my_param_name}.
If Wait for Function Call is disabled, the function will run in the background (asynchronously), and the main flow will continue immediately. You will not be able to capture a result from the function in this mode.
Error Handling
FUNCTION_REQUIRED— Triggered when no function has been selected in the configuration.FUNCTION_NOT_FOUND— Triggered if the selected function no longer exists in the project.ACTIONS_NOT_FOUND— Triggered if the function is defined but contains no logic blocks.PARAM_MISSING— Triggered when a parameter marked as "Required" in the function definition is not provided.EXECUTION_FAILED— Triggered if an unexpected error occurs during the execution of the function's flow.
(Note: These errors do not populate the Response Variable. They terminate the flow via the error edge.)
Example
Suppose you have a function named CalculateTax that takes a subtotal and returns the total_with_tax.
- Add the Execute Function block to your flow.
- Select CalculateTax from the Function dropdown.
- Enable Wait for Function Call.
- In the Parameters section, set the
subtotalvalue to{request.body.amount}. - Set the Response Variable to
final_amount. - After this block runs, the variable
{final_amount}will contain the calculated value, which you can then use in a Response block.
