Add a Function block
To create a Function block, click + in the Functions section of the left panel. You can configure optional parameters for each block that you can reference within the block itself. Each parameter must have a test value so it can perform a test run without being called.
You can also create Function blocks directly from a block's code editor. Type
/ on a new line and enter the name of a resource, then press Enter. You can also reference an existing function in the same way by entering the name of an existing function.
The resource name refers to the name used by your Retool organization (e.g., onboarding_db), not the name of the service used (e.g., PostgreSQL).
You call Function blocks using
await and include values for each parameter, if set. For example:
const subs = getExpiringSubscriptions.data;
const message =
": You have " +
" subscription(s) expiring this week!";
The Function block returns its output back to the block from which it was called, allowing it to be used in the rest of the workflow.