getWorkflowStaticData(type)#
这将允许你访问静态工作流数据。
🌐 This gives access to the static workflow data.
Experimental feature
- Static data isn't available when testing workflows. The workflow must be active and called by a trigger or webhook to save static data.
- This feature may behave unreliably under high-frequency workflow executions.
You can save data directly in the workflow. This data should be small.
例如:你可以保存从 RSS 源或数据库处理的最后一项的时间戳。它总是会返回一个对象。然后可以在该对象上读取、删除或设置属性。当工作流执行成功时,n8n 会自动检查数据是否已更改,并在必要时保存它。
🌐 As an example: you can save a timestamp of the last item processed from an RSS feed or database. It will always return an object. Properties can then read, delete or set on that object. When the workflow execution succeeds, n8n checks automatically if the data has changed and saves it, if necessary.
静态数据有两种类型:全局和节点。全局静态数据在整个工作流中都是相同的,工作流中的每个节点都可以访问它。节点静态数据是节点特有的,只有设置它的节点才能再次获取它。
🌐 There are two types of static data, global and node. Global static data is the same in the whole workflow. Every node in the workflow can access it. The node static data is unique to the node. Only the node that set it can retrieve it again.
包含全局数据的示例:
🌐 Example with global data:
=== “JavaScript”
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
1 2 3 4 5 6 7 8 9 10 11 | |
包含节点数据的示例:
🌐 Example with node data:
=== “JavaScript”
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
1 2 3 4 5 6 7 8 9 10 11 | |
模板和示例(Templates and examples)#
Workflow preview placeholder.
}