Back to Knowledge Base
How to Use Custom Actions
What is a Custom Action?
Section titled “What is a Custom Action?”A Custom Action is a saved, reusable Lua function that you can call from a Workflow Custom Action node. They let you encapsulate business logic once and reuse it across multiple Workflows — calculations, validations, data transformations, external API calls.
Custom Actions vs. Scripts
Section titled “Custom Actions vs. Scripts”| Custom Action | Script | |
|---|---|---|
| Where defined | Workflows menu → Custom Actions | Developer → Scripts |
| Where callable | Workflow Custom Action node | Workflow Script node |
| Use case | Shared business logic across Workflows | General-purpose Lua, templates, ML queries |
How to create a Custom Action
Section titled “How to create a Custom Action”- Go to Menu → Workflows → Custom Actions
- Click + New Custom Action
- Enter a Name (e.g.
Calculate Rush Fee) and optionally a Description - Define Input parameters — what data the action needs
- Define Output fields — what the action returns
- Write the Lua code in the editor
- Click Save
Example
Section titled “Example”-- Rush fee calculator-- Inputs: order_total (number), is_rush (boolean)-- Output: fee (number)
if input.is_rush then return { fee = input.order_total * 0.15 }else return { fee = 0 }endUsing a Custom Action in a Workflow
Section titled “Using a Custom Action in a Workflow”- In the Workflow editor, add a Custom Action node
- Select the Custom Action from the dropdown
- Map Workflow data to the action’s input parameters
- The node output contains the action’s return value
See also: How to Use Scripts for general-purpose Lua that runs directly in Script nodes.