Control Nodes
Control Nodes
Control nodes manage the flow of execution, transform data, and implement conditional logic. They help you build complex workflows with branching, filtering, and iteration.
Transform Data
Type: transform-data
The Transform Data node transforms input into a new data structure. This is one of the most commonly used nodes, essential for reshaping data between different formats.
transform:
type: transform-data
name: Format Contact Data
config:
output:
fullName:
$eval:
$concat:
- $var: input.trigger.fields.firstName
- " "
- $var: input.trigger.fields.lastName
email:
$var: input.trigger.fields.email
createdAt:
$eval:
$now: {}
metadata:
source: external-app
syncedAt:
$eval:
$now: {}
The output
configuration defines the structure of the transformed data. You can use variables ($var
), expressions ($eval
), or static values.
Output:
Returns the transformed object as specified in the output
configuration:
{
fullName: 'John Doe',
email: '[email protected]',
createdAt: '2024-01-15T10:30:00Z',
metadata: {
source: 'external-app',
syncedAt: '2024-01-15T10:30:00Z'
}
}
Filter
Type: filter
The Filter node conditionally allows data to continue through the flow. Only inputs that match the filter criteria are passed to downstream nodes.
filter:
type: filter
name: Only Active Contacts
config:
filter:
$eval:
$var: input.findContact.fields.status
$eq: active
Configuration options:
filter
– Filter expression using evaluation syntax (supports$eq
,$gt
,$and
,$or
, etc.)
Output:
The filter node passes through the input unchanged if it matches the filter. If the input doesn't match, no output is produced and the flow stops for that input.
For Each
Type: for-each-v2
The For Each node executes a subset of flow nodes for each item in a list, then aggregates their outputs. This is essential for processing arrays of data.
forEach:
type: for-each-v2
name: Process Each Contact
config:
items:
$var: input.listContacts
rootNodeKey: processContact
links:
- key: summary
processContact:
type: transform-data
name: Transform Contact
config:
output:
id:
$var: input.forEach.item.id
fullName:
$eval:
$concat:
- $var: input.forEach.item.fields.firstName
- " "
- $var: input.forEach.item.fields.lastName
links:
- key: createInCRM
createInCRM:
type: create-data-record
name: Create in CRM
config:
dataSource:
collectionKey: contacts
fieldMapping:
defaultValue:
name:
$var: input.processContact.fullName
summary:
type: transform-data
name: Create Summary
config:
output:
processed:
$var: input.forEach
allCreatedContacts:
$var: input.forEach.createInCRM
Configuration options:
items
– Array of items to iterate over (usually from a previous node's output)rootNodeKey
– Key of the first node inside the For Each loop
How it works:
- The For Each node receives a list of items
- For each item, it executes the nodes inside the loop (starting from
rootNodeKey
) - Inside the loop, the current item is available as
input.forEach.item
(whereforEach
is the key of your for-each node) - All nodes inside the loop run for each item
- After all items are processed, outputs are aggregated into a list
Accessing the current item:
Inside the For Each loop, access the current item:
$var: input.forEach.item
$var: input.forEach.item.id
$var: input.forEach.item.fields.email
Output structure:
The For Each node outputs an object with keys matching the nodes inside the loop, and values being arrays of their outputs:
{
processContact: [
{ id: '1', fullName: 'John Doe' },
{ id: '2', fullName: 'Jane Smith' }
],
createInCRM: [
{ id: 'crm-1', name: 'John Doe' },
{ id: 'crm-2', name: 'Jane Smith' }
]
}
Updated 4 days ago