fix(workflow): sendNotification skip-on-empty-toUserId + error precision + doc unification

- toUserId 解析为空时静默跳过 (succeeded, sentCount=0, skipped:true) 而非 failed
  → 支持'仅有重复订单时才通知'的条件通知编排
- 必填校验只列出实际缺失字段 (message),不再误报已解析的字段
- 文档统一变量格式: {{nodeId.path}} 为主,{{index.path}} 兼容
- spec 6/6,线上实测: 空收件人 skip + 非空正常发送均验证
This commit is contained in:
yeuimu
2026-08-17 10:11:25 +00:00
parent 146d62c80b
commit 80801346b5
3 changed files with 26 additions and 19 deletions
@@ -163,13 +163,15 @@ trigger or use the queue. Two caveats:
## Variable References (cross-node data)
An action can reference upstream nodes' output in string fields via `{{nodeIndex.path}}`:
An action can reference upstream nodes' output in string fields via `{{nodeId.path}}` (or the compatible `{{index.path}}` positional form):
- `{{1.record.id}}` — trigger record's id (trigger = node 1)
- `{{1.record.fields.Status}}` — trigger record's Status field
- `{{2.records}}` — output of the first action (node 2)
- `{{n0.record.id}}` — trigger record's id (n0 = trigger node)
- `{{n0.record.fields.Status}}` — trigger record's Status field
- `{{2.result}}` — output of the first action (numeric index form; index = topological execution order, trigger is always 1)
Node index follows **topological execution order** (trigger is always 1). Script actions can also read the merged upstream output directly via `triggerInput`.
Both forms resolve to the same value — `{{n0.record.id}}` ≡ `{{1.record.id}}`. Use `{{nodeId.path}}` in new workflows for clarity.
> **Empty-value semantics**: if a variable resolves to an empty string, the node sees the literal empty value. For `sendNotification`, an empty `toUserId` makes the node **silently skip** (status `succeeded`, `sentCount: 0`) instead of failing — so a script action that returns an empty recipient implements "notify only when X" conditional patterns. An empty `message` still fails with `Missing required fields: message`.
## Common Patterns
@@ -179,7 +181,7 @@ inkreach-teable workflow create --name "Status→email"
inkreach-teable trigger set wflXXX --type recordUpdated --table-id tblXXX --field-ids '["fldStatus"]'
inkreach-teable action add wflXXX --type sendEmail \
--to ops@x.com --subject 'Status changed' \
--body '{{1.record.fields.Status}}'
--body '{{n0.record.fields.Status}}'
inkreach-teable workflow activate wflXXX
```