在n8n中,每次工作流执行都会生成大量的运行数据。但是,当你需要快速查找某个特定的执行记录时,往往需要在无尽的执行列表中翻页搜索。Execution Data节点 就是为了解决这个问题而设计的!
它允许你保存自定义的元数据(键值对),这些数据会随着每次执行被记录下来,让你可以在执行列表中按这些元数据进行搜索和筛选。这对于调试问题、追踪特定客户的流程、或者进行工作流分析都非常有帮助。

Execution Data节点是n8n的一个核心节点,用于在工作流执行时保存自定义的元数据。这些元数据会被记录到执行历史中,允许你后续通过这些数据来搜索、筛选和管理执行记录。
| 功能 | 说明 |
|---|---|
| 保存元数据 | 在执行时添加自定义的键值对数据 |
| 快速搜索 | 在执行列表中按保存的元数据进行搜索 |
| 调试工作流 | 快速定位特定的执行记录进行排查 |
| 追踪关键信息 | 记录客户ID、订单号、处理状态等关键信息 |
使用Execution Data节点时,需要注意以下限制:
| 限制项 | 限值 | 说明 |
|---|---|---|
| Key长度 | 最多50个字符 | 键名不能超过50个字符,超出部分会被截断 |
| Value长度 | 最多512个字符 | 值不能超过512个字符,超出部分会被截断 |
| 可用性 | Pro/Enterprise | 仅在n8n Cloud Pro/Enterprise及自托管Enterprise版本中可用 |
💡 提示: 如果Key或Value超过限制,n8n会自动截断并输出日志提醒。
节点添加后,你会看到一个 "Saved Field" 参数区域:
每个Saved Field需要配置:
├─ Field Name(字段名):这个键的名称,最多50个字符
└─ Field Value(字段值):这个键对应的值,最多512个字符实际例子:
字段1:
- Field Name: customer_id
- Field Value: CUST-12345
字段2:
- Field Name: order_status
- Field Value: processing你不必手动输入固定的值,可以使用表达式从前面节点的数据中提取信息:
// 从JSON数据中提取客户ID
{{ $json.customer_id }}
// 从上一个节点获取订单号
{{ $prevNode.json.order_number }}
// 组合多个字段
{{ $json.name + " - " + $json.email }}
// 获取当前时间戳
{{ new Date().toISOString() }}在实际使用中,推荐保存这些元数据:
例如: 如果你保存了 customer_id: CUST-12345,就可以直接搜索 CUST-12345 找到所有相关的执行记录。
下面这个工作流演示了如何使用Execution Data节点来记录API请求的关键信息。
流程描述:
{
"active": false,
"name": "Order Processing with Execution Data Tracking",
"nodes": [
{
"parameters": {
"path": "webhook/order",
"httpMethod": "POST",
"responseMode": "lastNode",
"responseData": "{\n \"success\": true,\n \"message\": \"Order received\"\n}",
"options": {}
},
"id": "ab12cd34ef56",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [250, 300]
},
{
"parameters": {
"values": {
"string": [
{
"name": "order_id",
"value": "{{ $json.order_id }}"
},
{
"name": "customer_email",
"value": "{{ $json.customer_email }}"
},
{
"name": "amount",
"value": "{{ $json.amount }}"
}
]
},
"options": {}
},
"id": "gh78ij90kl01",
"name": "Set Order Data",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [450, 300]
},
{
"parameters": {
"values": {
"string": [
{
"name": "order_id",
"value": "{{ $json.order_id }}"
},
{
"name": "customer_email",
"value": "{{ $json.customer_email }}"
},
{
"name": "amount",
"value": "{{ $json.amount }}"
},
{
"name": "execution_time",
"value": "{{ new Date().toISOString() }}"
},
{
"name": "status",
"value": "processing"
}
]
},
"options": {}
},
"id": "mn23op45qr56",
"name": "Save Execution Metadata",
"type": "n8n-nodes-base.executiondata",
"typeVersion": 1,
"position": [650, 300]
},
{
"parameters": {
"url": "https://api.example.com/orders",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
"body": {
"order_id": "{{ $json.order_id }}",
"customer_email": "{{ $json.customer_email }}",
"amount": "{{ $json.amount }}"
},
"options": {}
},
"id": "st67uv89wx01",
"name": "Process Order API",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [850, 300]
},
{
"parameters": {
"values": {
"string": [
{
"name": "result_status",
"value": "{{ $json.status }}"
},
{
"name": "api_response",
"value": "{{ JSON.stringify($json).substring(0, 500) }}"
}
]
},
"options": {}
},
"id": "yz12ab34cd56",
"name": "Update Execution Status",
"type": "n8n-nodes-base.executiondata",
"typeVersion": 1,
"position": [1050, 300]
}
],
"connections": {
"Webhook Trigger": {
"main": [
[
{
"node": "Set Order Data",
"type": "main",
"index": 0
}
]
]
},
"Set Order Data": {
"main": [
[
{
"node": "Save Execution Metadata",
"type": "main",
"index": 0
}
]
]
},
"Save Execution Metadata": {
"main": [
[
{
"node": "Process Order API",
"type": "main",
"index": 0
}
]
]
},
"Process Order API": {
"main": [
[
{
"node": "Update Execution Status",
"type": "main",
"index": 0
}
]
]
}
}
}{
"order_id": "ORD-2024-001",
"customer_email": "customer@example.com",
"amount": "99.99"
}order_id 或 customer_email 快速搜索到这条执行记录customer_id 而不是 cid)Q: Execution Data节点和Code节点中的 $execution.customData 有什么区别?
A: Execution Data节点是一个可视化的节点,适合初学者使用。而Code节点中的 $execution.customData 需要编写JavaScript代码,提供更灵活的控制。两者都能实现相同的功能,选择哪个取决于你的偏好和技能水平。
Q: 保存的元数据可以在工作流运行时访问吗?
A: Execution Data节点保存的数据主要用于执行历史搜索。如果你需要在运行时访问这些数据,应该使用Code节点中的 $execution.customData。
Q: 超过512字符的值会怎样?
A: n8n会自动将值截断到512个字符,并在日志中记录一条警告信息。设计时要避免这种情况。
Q: 我可以保存多少个字段?
A: 使用Execution Data节点,你可以添加多个Saved Field。但整体的执行数据大小仍然受n8n的限制约束。建议不要超过10个自定义字段。
[1] 官方文档: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executiondata/
[2] n8n系列教程: https://www.undsky.com/blog/?category=n8n%E6%95%99%E7%A8%8B#