Files
n8n-docs/docs/code-examples/javascript-functions/variables.md
2022-04-13 09:56:05 +01:00

727 B

Custom variables

--8<-- "_snippets/code-examples/variables-list.md"

Examples

$executionId

Contains the unique ID of the current workflow execution.

const executionId = $executionId;

return [{json:{executionId}}];

$runIndex

Contains the index of the current run of the node.

// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
const allItems = $items("IF", 0, $runIndex);

$workflow

Gives information about the current workflow.

// Boolean. Whether the workflow is active (true) or not (false)
$workflow.active
// Number. The workflow ID.
$workflow.id
// String. The workflow name.
$workflow.name