logologo
Get Started
Guide
Development
Plugins
API
English
简体中文
Get Started
Guide
Development
Plugins
API
English
简体中文
logologo
Workflow
Overview
Getting Started

Triggers

Overview
Collection Event
Schedule
Pre-action Event
Post-action Event
Custom Action Event
Approval
Webhook

Nodes

Overview

AI

Large Language Model

Flow Control

Condition
Loop
Variables
Parallel Branch
Subflow
Output
Delay
End

Calculation

Calculation
Date Calculation
JSON Query
JSON Variable Mapping

Data Operations

Create Data
Update Data
Query Data
Delete Data
SQL Operation

Manual Processing

Manual Processing
Approval
CC

Extended Types

HTTP Request
JavaScript
Notification
Send Email
Response
Response Message
Variables
Execution History
Version Management
Advanced Options

Extension Development

Overview
Extending Trigger Types
Extending Node Types
API Reference
Previous PageLoop
Next PageParallel Branch

#Variable

#Introduction

You can declare variables in a flow or assign values to declared variables. This is typically used to store temporary data within the flow.

#Create Node

In the workflow configuration interface, click the plus ("+") button in the flow to add a "Variable" node:

Add Variable Node

#Configure Node

#Mode

The variable node is similar to variables in programming; it must be declared before it can be used and assigned a value. Therefore, when creating a variable node, you need to select its mode. There are two modes to choose from:

Select Mode

  • Declare a new variable: Creates a new variable.
  • Assign to an existing variable: Assigns a value to a variable that has been declared earlier in the flow, which is equivalent to modifying the variable's value.

When the node being created is the first variable node in the flow, you can only select the declare mode, as there are no variables available for assignment yet.

When you choose to assign a value to a declared variable, you also need to select the target variable, which is the node where the variable was declared:

Select the variable to assign a value to

#Value

The value of a variable can be of any type. It can be a constant, such as a string, number, boolean, or date, or it can be another variable from the flow.

In declare mode, setting the variable's value is equivalent to assigning it an initial value.

Declare initial value

In assignment mode, setting the variable's value is equivalent to modifying the value of the declared target variable to a new value. Subsequent uses will retrieve this new value.

Assign a trigger variable to a declared variable

#Using the Variable's Value

In subsequent nodes after the variable node, you can use the variable's value by selecting the declared variable from the "Node Variables" group. For example, in a query node, use the variable's value as a query condition:

Use variable value as a query filter condition

#Example

A more useful scenario for the variable node is in branches, where new values are calculated or merged with previous values (similar to reduce/concat in programming), and then used after the branch ends. The following is an example of using a loop branch and a variable node to concatenate a recipient string.

First, create a collection-triggered workflow that triggers when "Article" data is updated, and preload the related "Author" association data (to get recipients):

Configure Trigger

Then, create a variable node to store the recipient string:

Recipient variable node

Next, create a loop branch node to iterate through the article's authors and concatenate their recipient information into the recipient variable:

Loop through authors in the article

Inside the loop branch, first create a calculation node to concatenate the current author with the already stored author string:

Concatenate recipient string

After the calculation node, create another variable node. Select the assignment mode, choose the recipient variable node as the assignment target, and select the result of the calculation node as the value:

Assign the concatenated recipient string to the recipient node

This way, after the loop branch finishes, the recipient variable will store the recipient string of all the article's authors. Then, after the loop, you can use an HTTP Request node to call a mail sending API, passing the value of the recipient variable as the recipient parameter to the API:

Send mail to recipients via the request node

At this point, a simple bulk email feature has been implemented using a loop and a variable node.