Workflows
Blocks
Logic
Set Variable

Set Variable Block

What it does: Create or update variables within your workflow to store and reuse values throughout the process.

📦

In simple terms: Variables are like labeled containers that hold information. Use Set Variable to store a piece of data - like a customer's name or a calculation result - so you can use it later in other parts of your workflow.

When to Use This

Use Set Variable when you need:

  • ✅ Store values for later use
  • ✅ Combine multiple pieces of information
  • ✅ Transform data between steps
  • ✅ Set default values
  • ✅ Create calculated fields

Example: Store a customer's order total in a variable, then use it later to calculate tax and display the final amount.

Key Features

  • Flexible Values: Store text, numbers, dates, or complex data
  • Dynamic Assignment: Use values from other blocks
  • Overwrite or Create: Update existing variables or make new ones
  • Scope Control: Variables available throughout workflow

How Variables Work

  1. Name your variable: Choose a clear, descriptive name
  2. Set the value: What data to store
  3. Use later: Reference the variable in subsequent blocks

Setup Guide

Step 1: Add a Set Variable Block

Drag a Set Variable block into your workflow where you need to store data.

Step 2: Name Your Variable

Choose a name that describes what the variable holds:

Good NamesAvoid
customerEmailx
orderTotaltemp
discountAmountvar1
shippingAddressdata

Step 3: Set the Value

Define what value to store:

  • Static value: A fixed value you type in
  • Dynamic value: Reference from another block or variable
  • Combined value: Mix text with variable references

Step 4: Use Your Variable

Reference your variable in later blocks using the variable picker or by typing the variable name.

Common Use Cases

Store User Inputs

Save customer responses from chat for use in later parts of the workflow.

Calculation Results

Store the result of a calculation or script output for use elsewhere.

Default Values

Set initial values that may be updated as the workflow progresses.

Formatted Data

Create a nicely formatted string combining multiple data pieces.

Flags and State

Mark whether certain conditions have been met (true/false values).

Counters

Keep track of iterations in loops or counts of items processed.

Value Types You Can Store

TypeExampleUse Case
Text"Hello World"Messages, names, descriptions
Number42.5Calculations, counts, prices
Booleantrue/falseFlags, conditions, toggles
Date2024-01-15Scheduling, timestamps
List[item1, item2]Collections of items
Object{name: "John"}Structured data

Combining Values

You can combine static text with dynamic values:

Template: "Hello, {{customerName}}! Your order total is ${{orderTotal}}"

Result: "Hello, John! Your order total is $125.00"

What You Get Back

After setting a variable:

  • Variable stored: The value is saved for later use
  • Confirmation: Success status of the operation
  • Available throughout: Variable accessible in subsequent blocks

Tips for Success

  1. Use descriptive names - Future you will thank present you
  2. Set early, use often - Define variables before you need them
  3. Keep organized - Group related variables with similar naming
  4. Check for empty - Handle cases where data might be missing
  5. Update when needed - Variables can be changed throughout the workflow

Troubleshooting

ProblemLikely CauseSolution
Variable is emptyNever set or clearedVerify Set Variable runs before use
Wrong valueOverwritten laterCheck if variable is set multiple times
Not foundTypo in nameVerify spelling matches exactly
Type mismatchNumber stored as textCheck how value is being set

Best Practices

  • Name consistently - Use camelCase or snake_case throughout
  • Document purpose - Add notes about what each variable stores
  • Avoid overwriting accidentally - Be careful when reusing variable names
  • Initialize early - Set default values at workflow start
  • Clean up when done - Clear sensitive data when no longer needed
Indite Documentation v1.4.0
PrivacyTermsSupport