Skip to content

Commit e1dd5df

Browse files
committed
docs(automation): document the flat screen-field shape and visibleWhen
The flows guide covered the `object-form` screen step but never the default flat `fields` list, so the shape most screens actually use was undocumented — including `visibleWhen`, which this branch just made live on the wire. Records the three things an author cannot infer from the type: the predicate is bare CEL over the screen's own field names (NOT the `{var}` template dialect the rest of a node's config uses), `required` on a conditional field means "required when shown", and a `required` boolean needs `defaultValue: false` or the user cannot express "no" by leaving the box clear. Also notes that a broken predicate fails open, since nothing validates it at author time yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0122xvfanLmniNbsAPtg5hk3
1 parent 5cc47d1 commit e1dd5df

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

content/docs/automation/flows.mdx

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,50 @@ rather than evaluating an arbitrary JavaScript string:
210210
}
211211
```
212212

213+
**Screen (flat fields):**
214+
215+
The default shape. Each field is collected as a **bare flow variable**, so a
216+
later node reads `{subject}`, not `{screen_1.subject}`.
217+
218+
```typescript
219+
{
220+
id: 'screen_1',
221+
type: 'screen',
222+
label: 'Conversion Details',
223+
config: {
224+
fields: [
225+
{ name: 'createOpportunity', label: 'Create Opportunity?', type: 'boolean',
226+
required: true, defaultValue: false },
227+
{ name: 'opportunityName', label: 'Opportunity Name', type: 'text',
228+
required: true,
229+
visibleWhen: 'createOpportunity == true' },
230+
],
231+
},
232+
}
233+
```
234+
235+
`visibleWhen` is **bare CEL over the screen's own field names** — not the `{var}`
236+
template dialect the rest of a node's `config` uses. The client re-evaluates it
237+
as the user types, against the values collected so far, which is why it cannot
238+
be a server-interpolated template. Omit it for a field that is always visible.
239+
240+
A hidden field is not collected, and is **not enforced as `required`** — so
241+
`required` on a `visibleWhen` field means "required *when shown*". That is what
242+
lets the example above ask for an opportunity name only when one is being
243+
created.
244+
245+
Two things worth knowing:
246+
247+
- **Give a `required` boolean a `defaultValue`.** An untouched checkbox holds no
248+
value at all, which counts as unanswered — without `defaultValue: false` the
249+
user cannot express "no" by leaving it clear.
250+
- **A broken predicate fails open** (the field stays visible) rather than hiding
251+
an input the flow may be waiting on. Nothing validates the expression at
252+
author time yet, so a typo shows up as a field that never hides.
253+
213254
**Screen (object form):**
214255

215-
A `screen` node normally renders a flat `fields` list. Set `config.objectName`
256+
Set `config.objectName`
216257
to instead render an object's **entire** create/edit form — including any
217258
master-detail child grids (`inlineEdit`) — as one wizard step. The client
218259
renders the object form and, on save, **persists the record itself** (parent +

0 commit comments

Comments
 (0)