Skip to main content

Conditional fields

A static dialog asks the same questions every time. A conditional dialog adapts to what the user has already chosen: show IBAN only for a bank transfer, mark Cancellation reason as required only for a cancelled order, lock the Invoice number once the invoice exists.

The settings and their exact behaviour are listed on Form conditions. This page shows how to set them up.


At a glance​

Screen Designer ·[screens.crm.customers]✕ Cancel⤡unsaved changesWHAT IT ISCustomersDATAcustomers_get3 save query(ies)GRID6 column(s)3 filter(s) · 1 view(s)RECORD FORM2 tab(s)8 field(s)ACTIONS1 toolbar action(s)2 in the row menu · 1 on s…OUTPUTthe grid's own exportColumnsViewsSummary⠿STATUSStatus✕⠿CANCELLATION_REASONCancellation reason✕⠿PAYMENT_METHODPayment method✕⠿IBANIBAN✕⠿INVOICE_NUMBERInvoice number✕← CANCELLATION_REASON≋ CANCELLATION_REASON ›Required When: (new)FIELD ∗STATUS▾The filter column whose value gates this column's visibility.VALUE ∗CANCELLED✕+ addThe allowed value, or list of allowed values.from the Edit tab of the column:GeneralDisplayFilterRulesEditDefaultsREQUIRED☐ disabledREQUIRED WHEN+ addDISABLED WHEN+ addSave✕ CancelPick the columnthe field of the record formEdit tab ▸ Required when+ add opens a new conditionBack to the columnthe breadcrumb names the settingThe deciding fieldpicked from the screen's columnsOne or several valuesany of them matchesSeveral conditionsall must hold (AND)

Where to set them​

A dialog field displays a screen column, and the column carries every behaviour — the same settings drive the dialog and the grid. In the Screen Designer:

  1. On the Record form stage, click the field in the Dialog builder — or, on the Grid stage, pick the column in Columns.
  2. The column's settings show, split into tabs (Column configuration in the Inspector): the conditions sit in Filter (visible_when), Edit (required_when, disabled_when, disable_on_add, disable_on_edit), Defaults (default_when, write_when) and Rules (rules_when).
  3. Under the setting, + add opens a new condition in the same panel — its breadcrumb reads Required When: (new), for example: pick the Field among the screen's columns and give the Value, or several values (+ add under Value). The breadcrumb leads back to the column.

All the lines of one setting must match together (AND). For an OR on the same field, list the values in one condition.


Worked examples​

Show fields for one choice​

A Payment dialog where PAYMENT_METHOD is a list (CASH, TRANSFER, DIRECT_DEBIT, CARD):

Columnvisible_when
IBANPAYMENT_METHOD = TRANSFER, DIRECT_DEBIT
BICPAYMENT_METHOD = TRANSFER, DIRECT_DEBIT
CARD_LAST4PAYMENT_METHOD = CARD

With CASH, none of the three fields shows. With TRANSFER, IBAN and BIC appear.

Mark a reason as required on cancellation​

Columnrequired_when
CANCELLATION_REASONSTATUS = CANCELLED

The field always shows; it gets the required asterisk as soon as the status is CANCELLED.

Lock a key once the row exists​

ColumnSetting
INVOICE_NUMBERdisable_on_edit ticked

The number is typed when the invoice is added, then read-only — in the dialog and in grid editing. disable_on_add does the reverse, for a value assigned on creation.

Force a value for one kind of row​

Columndefault_when
CREDIT_LIMITSTATUS = CANCELLED → default 0, lock on

As soon as the status becomes CANCELLED, the limit switches to 0 and locks. With lock off, 0 is only proposed and the user can change it.

Make closed periods read-only​

On the screen's What it is stage:

SettingValue
editable_whenPERIOD_STATUS = OPEN, VALIDATED

A row of a closed period opens in view-only mode, and the server refuses changes to it.


Things to know​

SituationWhat happensWhat to do
The deciding field is not on the dialog.Its value is unknown to the form: the condition never matches, and the dependent field stays hidden.Add the deciding field to the dialog, hidden or not.
visible_when on a key column.A user adding a row may not see the key.Lock a key (disable_on_edit); do not hide it.
required_when matches while visible_when does not.A hidden field is never demanded: Save goes through with it empty.Keep the two conditions in line.
A value with different spelling.The condition never matches: values are compared exactly (only the surrounding spaces are ignored).Copy the stored codes, not their labels.
A threshold (AMOUNT > 1000).Conditions only test equality.Return a flag from the read query (HIGH_VALUE = 'Y') and test that flag.

What's next​