# Custom actions: buttons that run a function

> Offer a button on a record type that runs a function, shape its form and result, add a search input, and control which end users may run it.

A custom action is a named button on a record type that runs a function, for example "Calculate" on a Calculation type. Use one when you want people to start a piece of logic on demand and see its result.

The easiest way to add one is to ask Rad Bot. It offers actions as part of a change to the record type, or in the card that creates it. Before it shows you the card, it checks the function name, the fields the record gets, and that no field controlled by a workflow is set.

## What an action does

An action passes the person's input to the function. By its output mode, it does one of three things:

| Output mode | What happens |
|---|---|
| **Returns** | Shows the result to the person. |
| **Creates a record** | Makes a record of the type from the result. The person who ran it owns that record. |
| **Runs as a job** | Does long work in the background. |

An action whose function reads and writes records changes them as the person who runs it. The record type's editor says which records the action changes. After a run, the dialog lists the records it created or updated.

Actions are short: 20 seconds in all. Anything longer, or anything that waits for a person, belongs in a workflow. To run a function without a button press, see [Running a function when records change](/docs/app-builder/automations-and-run-function-step).

## Who may run an action

Running an action needs the **run** permission on the record type for the End user role. Without it, end users cannot run the action. See [What end users and visitors may do](/docs/app-builder/end-user-access).

You can also put an action on a website page with the **Run an action** component.

## Shape the form

The form is built from the function's inputs, not from the record's fields. Each input can carry these settings:

| Setting | What it does |
|---|---|
| `title` | The input's label. |
| `description` | The hint under it. |
| `enum` | A fixed list of choices. |
| `minimum`, `maximum` | Limits on a number. The server refuses a value outside them. |
| `format` | `date`, `time`, `email` or `url`. A `time` must be written HH:MM or the server refuses it. |

The form asks for inputs in the order they are written. Ask Rad Bot to change any of these, for example: "Label the first input Order number and limit the quantity to 100."

## Shape the result

The form shows a function's result using the function's output description:

| Setting | Effect |
|---|---|
| `title` | Names a value. |
| `x-order` | Orders the values. |
| `x-headline: true` | Shows one value first and larger. |
| `x-hidden: true` | Leaves a value off the page. |
| `format: "uri"` | Makes a value a link. |

`x-hidden` is not for secrets. A hidden value is still sent to the browser. A record's id is left out of the result unless you give it a `title`.

## Check data on the record itself

A record field can also carry its own validation, checked every time a record is saved:

- Text: length, a pattern with its message, and a format.
- Number: a minimum, a maximum, or whole numbers only.
- Date: past only or future only.

Rad Bot sets these when it builds. You can ask it to change a rule. For how validation looks to people filling a form, see [How validation works](/docs/validation/how-validation-works).

## Add a search input

When a value should be picked from many choices, such as your own records or results from an outside service, the form can show a search box. Ask Rad Bot, for example: "Let people search for a product on this form."

Rad Bot adds two things:

1. A function that takes `{"query": text}` and returns `{"options": [{"value", "label", "description"}]}`, with at most 20 options. An action on the same record type runs it.
2. `"x-lookup": {"action": "<name>"}` on that input of your main function, where `<name>` is the search action.

The search function runs as the person types, so it must return its output and write nothing. If it may write, or the action is missing or does not return its output, the form shows an ordinary input instead.

The person types at least two characters, then picks a match. Only a picked value counts. Each search counts as a function run.

The picked value comes from the browser. Where it affects money or access, your function must check it again itself.

## When it does not work as expected

- **End users cannot see or run the action.** Check that the End user role has the **run** permission on the record type.
- **A form shows a plain input instead of a search box.** The search function may write records, or the action may be missing or may not return its output.
- **A value is refused.** It may be outside a `minimum` or `maximum`, or a time not written HH:MM.

For the people who can use your website, see [What your end users and visitors can do](/docs/app-builder/end-users-start-here).

Source: https://radp.io/docs/app-builder/custom-actions
Last updated: 2026-11-29
