Flow reference: Logic

Run code

Call a function from this flow's code file.

Call a function from this flow's code file.

When and how to use it

Connect the input from the preceding step on the path that should perform this operation.
Fill the fields with data available in the trigger's context.
Connect the needed outputs; an unconnected path cannot run later blocks.

Configuration fields

Function name — fn


Exact exported function name from this flow's code file, without parentheses. It executes in the restricted flow sandbox, not Node.js.

Input: Text.

Editor guidance: An exported function in the flow's Code tab.

Default: calculate.


Variable prefix — storeAs


Choose a short result prefix such as result. Later blocks must use this same prefix and run after this block. It is not a Discord channel or a persistent table.

Input: Text.

Editor guidance: Returned keys become {prefix.key}.

Default: code.

Outputs and next steps

out: Continue to the next step.
error: The step failed; handle its error output instead of reporting success.

Read the result after this block, using its configured prefix and the fields supported by the selected operation. Do not assume every response has a text or id field.

Test and troubleshoot

Invoke the correct trigger with simple inputs and verify the expected effect. Confirm variables exist on this path. A preview alone does not verify Discord delivery.

Save, validate and publish. Perform one real test and read the first relevant log error. [Testing](/docs/flow-testing) · [Variables](/docs/flow-variables) · [Permissions](/docs/flow-permissions).