Expressions
Expressions allow you to put dynamic data in the node parameter. The data can be from the workflow variables or the previous node.
To use expressions as the parameter node value, enable the “Expression” toggle in the node parameter and write the expression by using the {{ expression here }}
format. You can write JavaScript inside the expression and use the built-in expression function. The returned value will used as the node parameter value.
Inside the expression, you can only write a single-line code; multi-line code will be invalid. For example,
and the below example is invalid:
Built-in Functions
$getData
$getData(path: string): unknown
Function to access the workflow data like the workflow variables.
You can write dot-notation in the path parameter. See the dot-prop documentation for more details about the format you can use in the path parameter.
List of data you can access:
Property | Type | Description |
---|---|---|
vars | Record<string, unknown> | Workflow variables |
loopData | Record<string, LoopData> | The Looping Node data. The property key is using the node id of the Looping node |
prevNode | unknown | null | Data returned by the previous node |
parentWorkflow | { id: string; vars: Record<string, unknown> } | null | The parent workflow data. This will be available if the workflow is executed using the Workflow Execute Node |
Examples
Let’s say the workflow has data like the below
To access data using the function:
$setVars
$setVars(name: string, value: unknown): void
Set a workflow variable value.