How-to

Conditional field rules

Field rules make one field depend on others. A rule can limit which entries a reference accepts, fill in a field when it is empty, clear it, or lock it, and each rule applies only while its conditions hold. Rules are enforced on every save, whether from the form, an agent, an import, an automation, or your website.

Field rules make one field depend on others. A rule can limit which entries a reference accepts, fill in a field when it is empty, clear it, or lock it, and each rule applies only while its conditions hold. Rules are enforced on every save, whether from the form, an agent, an import, an automation, or your website.

Requirements

A role that can edit the collection's fields.

What a rule does

RuleEffect while its conditions hold
Limit choicesA reference, or a field pointing at several entries, accepts only certain entries. Anything else is refused on save.
Fill inSets a value in a field, but only if the field is empty. A value someone entered always wins.
ClearEmpties a field.
LockMakes a field read-only. It can also clear the field as it locks it.
UnlockCancels a lock on the same field, whichever rule comes first.

Three ways to limit choices

  • From another field's entry. On a work order, the vehicle must be one of the vehicles listed on the customer already chosen. Choose a different customer and the allowed vehicles change with it.
  • From a fixed list. The field accepts only the entries you list, such as three approved suppliers.
  • By what the target points back at. On a booking, the consultant must be one whose own record lists the service already chosen.

Conditions

Every rule runs only while its conditions match the entry being saved, taking into account both what is already stored and what is being changed. A rule for when status is Active does nothing while the entry is a draft. A rule with no conditions never runs.

Steps

  1. Open the collection's fields and add a rule to the target field, the one whose value depends on others.
  2. Set the conditions under which it applies.
  3. Choose the effect: limit choices, fill in, clear, lock, or unlock.
  4. Save, then test it with an entry that meets the conditions and one that does not.

Notes and limitations

  • Several rules add up. When more than one limiting rule applies, a value must satisfy all of them.
  • An impossible rule refuses everything. If the customer has no vehicles yet, the vehicle field can accept nothing until a vehicle is added. The save names the rule that failed.
  • Filled-in values surprise people. A save can come back with fields the rule filled or cleared; read the saved entry rather than assuming it matches what was sent.
  • A "by what the target points back at" rule needs the field it checks to be searchable on the target collection; otherwise it is skipped.
  • A field used by a rule cannot be archived until the rule changes.
  • Why a save was refused is covered in My entry will not save.

For the fields rules act on, see Fields: built-in and your own and How references connect entries.

Frequently asked questions

Will a fill-in rule overwrite what I typed?
No. A fill-in rule sets a value only when the field is empty; a value someone entered wins.
Why does my rule not apply?
Rules apply only while their conditions hold. A rule for Active entries does nothing while the entry is a draft.
Do rules apply to imports and my website?
Yes. Rules are enforced on every save, including imports, automations, agents, and your website.