Execution Context
当前运行、正在执行的工作流与节点的 id,以及环境。
每个示例都在已部署的表达式引擎上、基于页面末尾的示例上下文运行过。
$execution
运行的身份标识。在消息、任务和日志中写入 $execution.id,任何人都能据此把一个案例追溯到对应的运行。当运行由 workflow.chain 启动时,id 是根运行的 id,因此链中所有工作流共用这个值;run_flow_instance_result_id 则保留本次运行自身的 id。
成员
| 签名 | 类型 | 说明 |
|---|---|---|
$execution.id | string | 运行的主 id:链的根运行的结果 id;没有链时为本次运行的结果 id。 |
$execution.flow_instance_result_id | string | null | 主结果 id(与 id 的值相同)。 |
$execution.root_flow_instance_result_id | string | null | 链的根运行的结果 id。 |
$execution.run_flow_instance_result_id | string | null | 本次运行的结果 id,在链中同样适用。 |
$execution.flow_instance_id | string | null | 流程实例的 id。 |
$execution.flow_definition_id | string | null | 工作流定义的 id。 |
$execution.flow_version_id | string | null | 正在运行的已发布版本的 id。 |
$execution.flow_slug | string | null | 工作流的 slug。 |
$execution.mode 保留 | string | 保留:用于区分测试运行与生产运行;目前始终为 'manual'。 |
$execution.resumeUrl 保留 | undefined | 保留:用于恢复已暂停的运行;目前始终为 undefined。 |
$execution.customData 保留 | object | 保留:始终为 {}。 |
示例
保留成员:每次运行的值都相同。
说明
- 本次运行不具备的字段为
null。id 是不透明文本:只做比较,切勿解析。 - 节点自身的
execution配置字段(其重试设置)与$execution无关。
在 JSONata 中 $$execution.id
$workflow
正在执行的工作流。请使用 slug 和 version;id、name 和 active 为保留成员,目前保存固定值(如需定义的 id,请读取 $execution.flow_definition_id)。
成员
| 签名 | 类型 | 说明 |
|---|---|---|
$workflow.slug | string | null | 工作流的 slug。 |
$workflow.version | string | null | 标识正在运行的版本(目前为已发布版本的 id)。请将其视为不透明值,而非数字。 |
$workflow.id 保留 | string | 保留:目前始终为 'unknown'。请使用 $execution.flow_definition_id。 |
$workflow.name 保留 | string | 保留:目前始终为 'Untitled'。 |
$workflow.active 保留 | boolean | 保留:目前始终为 false。 |
示例
完整对象,包括保留成员。
在 JSONata 中 $$workflow.slug
$node
正在执行的节点的元数据。它不能用来读取其他节点;如需读取,请使用 $('Node label')。
成员
| 签名 | 类型 | 说明 |
|---|---|---|
$node.id | string | 节点的 node_id。 |
$node.label | string | null | 节点的标签,与画布上显示的一致。 |
$node.name | string | null | 与 label 的值相同。 |
示例
在 JSONata 中 $$node.label
$env
保留. 引擎尚未填充它:目前始终为 {}。
用于存放为工作流运行所在环境声明的变量。引擎目前尚未填充它:它始终是空对象,并且绝不会暴露服务自身的环境。请通过触发器输入或 Git Sync 环境传递特定于环境的值,通过绑定到节点的凭据传递机密。
示例
在它为空时,默认值可让表达式照常工作。
在 JSONata 中 $$env
$vars
保留. 不会被填充:目前始终为 {}。
为工作流变量保留。它始终是空对象。切勿把机密放进变量:请改为给节点绑定凭据。
示例
在 JSONata 中 $$vars
$nodeVersion
保留. 目前始终为 1。
用于表示执行当前节点的算子的版本。无论节点的 operator_version 是什么,它始终为 1。算子版本是工作流文件中节点定义的一部分。
示例
在 JSONata 中 $$nodeVersion
示例上下文
示例基于以下数据运行:当前节点的输入($json)、已运行的节点($(…))、本次运行的 ID 以及当前节点。时钟固定为 2026-11-26T14:30:00.000Z,服务器时区为 UTC,因此各页面中 $now 与 $today 的值都相同。
{
"$json": {
"body": {
"order_id": "ord_1042",
"email": "[email protected]",
"customer": {
"name": "Ana Pérez",
"segment": "gold"
},
"priority": "",
"items": [
{
"sku": "A-100",
"qty": 2,
"price": 10.5
},
{
"sku": "B-200",
"qty": 0,
"price": 4
},
{
"sku": "C-300",
"qty": 1,
"price": 25
}
],
"tags": [
"new",
"web",
"new"
],
"created_at": "2026-11-25T09:15:00Z"
},
"headers": {
"content-type": "application/json"
},
"query": {},
"method": "POST"
}
}{
"Webhook Receiver": "= $json",
"Normalize input": {
"correlation_id": "c-7f3a",
"channel": "web"
},
"Classify": {
"label": "billing",
"confidence": 0.92
}
}{
"$execution": {
"id": "fir-xxxx",
"flow_instance_id": "fi-xxxx",
"flow_definition_id": "fd-xxxx",
"flow_version_id": "fv-xxxx",
"flow_slug": "order-intake"
},
"$node": {
"id": "node-notify",
"label": "Notify customer"
}
} 示例运行所基于的编排器提交 31e874b