Function Caller
1. Overview
The Function Caller component (function-caller) calls a function previously registered by the Function component, passing a data body and receiving the result of its execution. It's the "call button" for the function created with the Function component.
Use it whenever you need to reuse logic already defined as a function elsewhere in the flow. Don't use it if the function hasn't been registered anywhere in the same flow with the Function component — the call will fail.
2. Prerequisites
- A Function component already registered with the name to be called must exist in the same flow.
- No external credentials involved.
3. Authentication and Connection
Not applicable.
4. Configuration / Supported Operations
Function Caller has a single operation: invoke the function by name and return its result.
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
functionName | Yes | Expression | Name of the function to call (must match the name configured in the corresponding Function component). | "validateCustomer" |
body | No | Expression | Data body to send to the function. If not informed, the message's current body is used as-is. | An expression that builds a custom object for the function |
Error behavior:
- If
functionNameisn't informed, is empty, or doesn't resolve to any value, execution fails with an error. - If the function with the resolved name isn't registered, execution fails with the error "Function '[name]' not found. Make sure it is registered."
- If any failure occurs during the called function's execution, the error is propagated with the message "Failed to execute function '[name]': [detail]".
At the end, the result (body and success status) returned by the called function replaces the body and status of the current message.
5. Practical Examples
Simple example: a customer-registration flow calls the "validateCustomer" function (previously registered) without informing body, i.e., passing the message's current body as the validation input.
Input:
{
"name": "Maria Silva",
"taxId": "123.456.789-00",
"email": "maria@example.com"
}
Component configuration:
{
"componentName": "function-caller",
"configurations": { "functionName": "validateCustomer" }
}
Response (the body returned by the validateCustomer function replaces the message's current body):
{
"valid": true,
"issues": []
}
Advanced example: a batch-import flow builds, for each item, a custom body in the body field (containing only the fields needed for validation), calls the "validateCustomer" function, and uses its result to decide the next steps — for example, combining with a Choice component right after to separately handle valid and invalid items.
Input:
{
"row": { "fullName": "John Smith", "document": "987.654.321-00", "contact": "john@example.com" }
}
Component configuration:
{
"componentName": "function-caller",
"configurations": {
"functionName": "validateCustomer",
"body": "{ \"name\": \"{$.body.row.fullName}\", \"taxId\": \"{$.body.row.document}\", \"email\": \"{$.body.row.contact}\" }"
}
}
Response:
{
"valid": false,
"issues": ["Invalid tax ID"]
}
6. Points of Attention
- The called function needs to be registered and active at the time of the call.
- The call is always synchronous — Function Caller waits for the function to finish before continuing.
- Errors inside the called function interrupt Function Caller's execution (there's no "continue despite error" option on this component).
7. Common Errors and Troubleshooting
| Error / Symptom | Likely Cause | How to Fix |
|---|---|---|
| "Function name is required in configuration" | The functionName field wasn't filled in or didn't resolve to any value. | Fill in functionName with a valid value. |
| "Function '[name]' not found. Make sure it is registered." | There's no active Function component with that name in the flow. | Check that the name is correct and that the corresponding Function component is active. |
| "Failed to execute function '[name]': [detail]" | The called function threw an error during its execution. | Investigate the cause of the error inside the called function's logic, using the message detail. |