Skip to main content

SET

Sets variables in the flow context. Can execute steps, evaluate expressions, or set key-value pairs.

At a glance

  • Category Control
  • Version: 1.0.3
  • Applications: all
  • Scope: all

When to Use

Use SET when you need to create or modify variables in the workflow context for use in subsequent steps.

Use SET when:

  • You need to store simple values (strings, numbers, booleans, objects)
  • You want to prepare data before passing to other steps
  • You need to resolve templates and store the result
  • You want to execute JavaScript expressions and store results
  • You need to transform or combine existing variables

Don't use SET when:

  • You need user input - use FORM or PROMPT for interactive input
  • You need complex multi-statement logic - use SCRIPTING for full JavaScript programs
  • You only need to pass data without storing - most steps can read flowContext directly

Alternatives:

  • SCRIPTING - For complex JavaScript logic with multiple statements and control flow
  • FORM - For collecting user input interactively
  • PROMPT - For simple single-value user input

Config Options

NameDescriptionDefaultRequiredResolvedConstraintsConditional Rules
stepsSteps to execute before setting the variable. The result is stored in the flow context.NonefalsefalseNoneNone
expressionJavaScript expression to evaluate and set as the variable value.NonefalsefalseNoneNone
textText to resolve (with variables) and set as the variable value.NonefalsetrueNoneNone
raw_textRaw text to set as the variable value without resolution.NonefalsefalseNoneNone
nameName of the variable to set in the flow context.NonefalsefalseNoneNone
convertToConvert the value to a specific type (e.g., "number").NonefalsefalseNoneNone

Outputs

TypeDescriptionOptional
textThe resolved value stored in the flow context (when using legacy name/text syntax).false

Examples

Set multiple variables (new syntax)

 - step: SET
userId: "{{ flowContext.currentUser.id }}"
isActive: true
count: 5
convertTo: "number"

Set a variable using text (legacy syntax)

 - step: SET
name: "userMessage"
text: "Hello {{userName}}"

Set numeric variables

 - step: SET
count: 5
convertTo: "number"

Common Pitfalls

Don't confuse new syntax with legacy syntax - mixing them causes unexpected behavior

Why: SET supports two different syntaxes: direct properties (new) and name/text (legacy). Mixing them can create unintended variables or overwrite data.

Solution: Use new syntax for most cases (simpler): SET userId: "123". Use legacy syntax only when needed for compatibility: SET name: "userId" text: "123".

Don't forget that template strings are resolved - use raw_text for literal strings

Why: The text property resolves {{ }} templates. If your string contains {{ or }}, it will be interpreted as a template.

Solution: Use raw_text for literal strings that contain {{ or }} characters, or escape them in templates.

Don't forget type conversion - numbers in templates are strings

Why: Template resolution produces strings. "{{ 5 }}" becomes "5" (string), not 5 (number), which breaks numeric operations.

Solution: Use convertTo: "number" to convert string values to numbers, or use expression mode for numeric calculations.

See Also

Related Steps:

  • SCRIPTING - Alternative for complex logic: Use SCRIPTING for multi-line JavaScript with loops and conditionals. Use SET for simple value assignments and single expressions.
  • FORM - Alternative for user input: Use FORM to collect data from users interactively. Use SET to store programmatic values.
  • PROMPT - Alternative for simple input: Use PROMPT for single user input. Use SET for storing calculated or static values.
  • FOR - Use together for iteration: Use SET inside FOR loops to accumulate results or maintain counters.
  • IF - Use together for conditional assignment: Wrap SET in IF to conditionally set variables based on logic.

General Resources: