Logic

Functions

A function is a visual graph of nodes that runs on your server. It is how pages get data, how forms and events do work, and how your site talks to other services.

What a function does

A function does math and logic, runs your custom queries and calls the external APIs you register. You build it by connecting nodes on a canvas, without writing code.

Page events run functions when a page loads or a button is clicked.

Event triggers run functions when something happens, such as a new user signing up.

Scheduled triggers run functions on the clock.

A function's outputs fill page variables, which your pages then show.

Create a function

1

Open Functions

In the admin panel, go to System Configuration, then Functions.

2

Click Add Function

Enter a Function Name and an optional Description.

3

Open it

Click Edit. The tabs are Node Editor, General configuration, Triggers, Runs, JSON View and Test.

4

Build the graph

In Node Editor, use Add node, connect the nodes and click Save.

JSON View shows the raw nodes and connections and lets you edit them directly.

Test before you use it

1

Open the Test tab

Enter the input values as JSON.

2

Keep Dry run on

Database changes from custom queries are rolled back after the run.

3

Click Execute

Read the Outputs and the Execution trace. If it fails, Failed at node tells you where.

A dry run does not undo external API calls. If the function sends an email, charges a card or creates something in another service, that still happens.

Who can run it

On the General configuration tab, Who can run this function decides who may run it from a page, a form or any other request.

Everyone (public)

Anyone, signed in or not.

Signed-in users and admins

Visitors who are not signed in are refused.

Admins only

For admin tools, such as deleting data.

Automations only (no page can call it)

Only event and scheduled triggers run it, plus an admin testing it.

Event and scheduled triggers are never blocked by this setting. Choose Automations only for any function that exists for automations, especially one that writes data or calls a paid API.

Status and live changes

Use Deactivate and Activate in the Functions list to change a function's status.

Deactivating a function stops event and scheduled triggers from running it. Page events and forms can still run it, so remove it from those too.

Editing a function that a live page uses changes that page's behaviour as soon as you save.

Only admins see a run's trace and error details. Visitors get the outputs on success and nothing on failure.

Keep each function to one job. Small functions are easier to test and reuse.