构建工作流

Customize executions data

You can set custom data on your workflow using the Code node or the Execution Data node. n8n records this with each execution. You can then use this data when filtering the executions list, or fetch it in your workflows using the Code node.

Set and access custom data using the Code node

This section describes how to set and access data using the Code node. Refer to Execution Data node for information on using the Execution Data node to set data. You can't retrieve custom data using the Execution Data node.

Set custom executions data

Set a single piece of extra data:

JavaScript

js
$execution.customData.set("key", "value");

Python

python
_execution.customData.set("key", "value");

Set all extra data. This overwrites the whole custom data object for this execution:

JavaScript

js
$execution.customData.setAll({"key1": "value1", "key2": "value2"})

Python

python
_execution.customData.setAll({"key1": "value1", "key2": "value2"})

There are limitations:

  • They must be strings
  • key has a maximum length of 50 characters
  • value has a maximum length of 255 characters
  • n8n supports a maximum of 10 items of custom data

Access the custom data object during execution

You can retrieve the custom data object, or a specific value in it, during an execution:

JavaScript

js
// Access the current state of the object during the execution
const customData = $execution.customData.getAll();

// Access a specific value set during this execution
const customData = $execution.customData.get("key");

Python

python
# Access the current state of the object during the execution
customData = _execution.customData.getAll();

# Access a specific value set during this execution
customData = _execution.customData.get("key");

官方原文和授权

本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。

来源、授权与修改

本站保留许可证、固定提交号、社区作者和修改说明,不代表 n8n 对本站背书。

查看许可证查看来源和修改说明