mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2026-03-27 17:38:40 +07:00
78 lines
2.2 KiB
Markdown
78 lines
2.2 KiB
Markdown
# CustomData
|
|
|
|
## `$execution.customData`.**`get()`**
|
|
|
|
**Description:** Returns the custom execution data stored under the given key. <a href="/workflows/executions/custom-executions-data/">More info</a>
|
|
|
|
**Syntax:** `$execution.customData`.get(key)
|
|
|
|
**Returns:** String
|
|
|
|
**Source:** Custom n8n functionality
|
|
|
|
**Parameters:**
|
|
|
|
* `key` (String) - The key (identifier) under which the data is stored
|
|
|
|
**Examples:**
|
|
|
|
```javascript
|
|
// Get the user's email (which was previously stored)
|
|
$execution.customData.get("user_email") //=> "me@example.com"
|
|
```
|
|
|
|
## `$execution.customData`.**`getAll()`**
|
|
|
|
**Description:** Returns all the key-value pairs of custom data that have been set in the current execution. <a href="/workflows/executions/custom-executions-data/">More info</a>
|
|
|
|
**Syntax:** `$execution.customData`.getAll()
|
|
|
|
**Returns:** Object
|
|
|
|
**Source:** Custom n8n functionality
|
|
|
|
**Examples:**
|
|
|
|
```javascript
|
|
$execution.customData.getAll() //=> {"user_email": "me@example.com", "id": 1234}
|
|
```
|
|
|
|
## `$execution.customData`.**`set()`**
|
|
|
|
**Description:** Stores custom execution data under the key specified. Use this to easily filter executions by this data. <a href="/workflows/executions/custom-executions-data/">More info</a>
|
|
|
|
**Syntax:** `$execution.customData`.set(key, value)
|
|
|
|
**Source:** Custom n8n functionality
|
|
|
|
**Parameters:**
|
|
|
|
* `key` (String) - The key (identifier) under which the data is stored
|
|
* `value` (String) - The data to store
|
|
|
|
**Examples:**
|
|
|
|
```javascript
|
|
// Store the user's email, to easily retrieve all execs related to that user later
|
|
$execution.customData.set("user_email", "me@example.com")
|
|
```
|
|
|
|
## `$execution.customData`.**`setAll()`**
|
|
|
|
**Description:** Sets multiple key-value pairs of custom data for the execution. Use this to easily filter executions by this data. <a href="/workflows/executions/custom-executions-data/">More info</a>
|
|
|
|
**Syntax:** `$execution.customData`.setAll(obj)
|
|
|
|
**Source:** Custom n8n functionality
|
|
|
|
**Parameters:**
|
|
|
|
* `obj` (Object) - A JavaScript object containing key-value pairs of the data to set
|
|
|
|
**Examples:**
|
|
|
|
```javascript
|
|
$execution.customData.setAll({"user_email": "me@example.com", "id": 1234})
|
|
```
|
|
|