Variables

Introduction

Variables are a set of tokens used to identify a value in the current context. They can be used in scenarios such as configuring block data scopes, field default values, linkage rules, and workflows.

20251030114458

Currently Supported Variables

Current User

Represents the data of the currently logged-in user.

20240416154950

Current Role

Represents the role identifier (role name) of the currently logged-in user.

20240416155100

Current Form

The values of the current form, used only in form blocks. Use cases include:

  • Linkage rules for the current form
  • Default values for form fields (only effective when adding new data)
  • Data scope settings for association fields
  • Field value assignment configuration for submit actions

Linkage rules for the current form

20251027114920

Default values for form fields (add form only)

20251027115016

Data scope settings for association fields

Used to dynamically filter the options of a downstream field based on an upstream field, ensuring accurate data entry.

Example:

  1. The user selects a value for the Owner field.
  2. The system automatically filters the options for the Account field based on the selected Owner's userName.

20251030151928

Current Record

A record refers to a row in a collection, where each row represents a single record. The "Current Record" variable is available in the linkage rules for row actions of display-type blocks.

Example: Disable the delete button for documents that are "Paid".

20251027120217

Current Popup Record

Popup actions play a very important role in NocoBase interface configuration.

  • Popup for row actions: Each popup has a "Current Popup Record" variable, representing the current row record.
  • Popup for association fields: Each popup has a "Current Popup Record" variable, representing the currently clicked association record.

Blocks within a popup can use the "Current Popup Record" variable. Related use cases include:

  • Configuring the data scope of a block
  • Configuring the data scope of an association field
  • Configuring default values for fields (in a form for adding new data)
  • Configuring linkage rules for actions

URL Query Parameters

This variable represents the query parameters in the current page URL. It is only available when a query string exists in the page URL. It is more convenient to use it with the Link action.

20251027173017

20251027173121

API token

The value of this variable is a string, which is a credential for accessing the NocoBase API. It can be used to verify the user's identity.

Current Device Type

Example: Do not display the "Print template" action on non-desktop devices.

20251029215303