JS Action is used to execute JavaScript when a button is clicked, allowing for custom business logic. It can be used in form toolbars, table toolbars (collection-level), table rows (record-level), and other locations to perform operations like validation, showing notifications, making API calls, opening pop-ups/drawers, and refreshing data.

ctx.api.request(options): Makes an HTTP request.
ctx.openView(viewUid, options): Opens a configured view (drawer/dialog/page).
ctx.message / ctx.notification: Global messages and notifications.
ctx.t() / ctx.i18n.t(): Internationalization.
ctx.resource: Data resource for collection-level context (e.g., table toolbar), including methods like getSelectedRows() and refresh().
ctx.record: The current row record for record-level context (e.g., table row button).
ctx.form: The AntD Form instance for form-level context (e.g., form toolbar button).
ctx.collection: Metadata of the current collection.
The code editor supports Snippets and Run for pre-execution (see below).
ctx.requireAsync(url): Asynchronously loads an AMD/UMD library from a URL.
ctx.importAsync(url): Dynamically imports an ESM module from a URL.
The actual available variables may differ depending on the button's location. The list above is an overview of common capabilities.
Snippets: Opens a list of built-in code snippets that can be searched and inserted at the current cursor position with a single click.Run: Executes the current code directly and outputs the execution logs to the Logs panel at the bottom. It supports console.log/info/warn/error and highlights errors for easy location.
ctx.openView, it's recommended to pass parameters explicitly and, if necessary, actively refresh the parent resource after a successful submission.